79586894

Date: 2025-04-22 15:54:51
Score: 0.5
Natty:
Report link

When you embed PowerShell commands in Batch Files, you should take great care in properly escaping the double quotes. By enclosing the whole PowerShell command in double quotes, you have to convert the double quotes character " to \"

Here's the correctedExample.bat script:

@echo off

set cwd=%~dp0
set argv=_%*
set argv=%argv:"=\"%
set argv=%argv:~1%
powershell -NoProfile -ExecutionPolicy Bypass -Command "& '%cwd%Example.ps1' %argv%"
Reasons:
  • Has code block (-0.5):
  • Starts with a question (0.5): When you
  • Low reputation (0.5):
Posted by: Fabrice SANGA