如果變數!batDir!包含空格,我將無法使用以下批處理代碼,例如W:\scripts windows\:
if /I "!i!" GTR "1" (
Powershell "!batDir!ript.ps1 !test! '!testWithSpaces!' "
goto :scriptEnd
)
W:\scripts : The term 'W:\scripts' is not recognized as the name of a cmdlet, function, script file, or operable
program.
uj5u.com熱心網友回復:
您需要使用帶有 & 的引號。
Powershell "& '!batDir!ript.ps1' !test! '!testWithSpaces!' "
https://newbedev.com/how-to-run-a-powershell-script-with-white-spaces-in-path-from-command-line
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/312642.html
