Executing Powershell Script

Hi,
I have strange problem with executing a Powershell Script from Deploy-Application.ps1.

These Command should install all Visual C++ Runtimes but I always get errors cause of wrong command or file destination. I think it’s all about quotation marks :slight_smile:
Maybe somebody can give me a hint how to set the marks in a correct order.

Execute-Process -FilePath "$env:WinDir\System32\WindowsPowerShell\v1.0\powershell.exe" -Parameters "-File "$DirFiles\Install-VisualCRedistributables.ps1" -Xml "$DirFiles\VisualCRedistributablesAll.xml" -Install" -WindowStyle 'Hidden'

Thank you in advance!
BR
Wiesel

What you need to do is escape the quotes in the parameters with the backtick character, under the tilde symbol. Just put a backtick before each of the quotes in the parameters except the beginning and ending quotes. I can never get code to post correctly here, so this probably won’t work, but I’ll give it another try:

<p>"-File “$DirFiles\Install-VisualCRedistributables.ps1” -Xml “$DirFiles\VisualCRedistributablesAll.xml” -Install" </p>

How did you post that code? I’ve tried several things and I can’t get it to work. :frowning:

Ok, I think I figured out how to post code… One more try. :slight_smile:

Execute-Process -FilePath “$env:WinDir\System32\WindowsPowerShell\v1.0\powershell.exe” -Parameters “-File <code>”$DirFiles\Install-VisualCRedistributables.ps1" -Xml “$DirFiles\VisualCRedistributablesAll.xml” -Install" -WindowStyle ‘Hidden’

Why don’t you just put the code from the Install-VisualCRedistributables.ps1 script directly in the Deploy-Application script?

Edit: It remove the backticks… :frowning: Well at least I’m getting closer… :slight_smile: