문제

I'm trying to figure out how to call a PowerShell script with spaces in the filename as a Delphi build event.

From CMD I have to call powershell.exe -Command "& 'Filename With Spaces.ps1'" which works fine.

Delphi on the other hand doubles the ampersand sign and is trying to turn the command into two commands.

I have tried to set this as the build event:

powershell.exe -Command "& '$(PROJECTDIR)\Prebuild.ps1' $(PROJECTDIR)"

What gets executed by MSBuild is:

powershell.exe -Command "&& 'D:\SVN\AccuLib 3.0\VCLUI\Prebuild.ps1' D:\SVN\AccuLib 3.0\VCLUI"

So what does it take to call a ps1 file containing spaces from a Delphi build event?

도움이 되었습니까?

해결책

Try the File parameter instead, it doesnt require an ampersand:

powershell.exe -File "Filename With Spaces.ps1"

다른 팁

To use an ampersand sign you can create an intermediate cmd script.

Delphi build event:

Prebuild.cmd "$(PROJECTDIR)"

Prebuild.cmd file:

powershell.exe -Command "& 'Filename With Spaces.ps1'"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top