terry
May 27, 2015, 4:06pm
#1
Hello I have an issue using the $dirfiles variable in a parameter.
Execute-Process -Path 'C:\Windows\System32\dism.exe' -Parameters '/Online /Add-Package /PackagePath:$dirfiles\Windows6.1-KB2786081-x64.cab /quiet /norestart /LogPath:C:\temp\PSAPP\Patches\KB2786081_Install.log' -PassThru
The issue is $dirfiles resolves to C:\Program Files\blah\blah
When the parameters are passed to dism quotes are not included in the path. Is there a way to have $dirfiles always include quotes in its path?
buster
May 27, 2015, 4:16pm
#2
When using a variable in the parameters section you need to change the quote style like this -Parameters “/s /f1^”$dirFiles\desktop.iss^"" The ^ are actually the ` key left of the 1 key it formats it out on the post.
terry
May 27, 2015, 4:35pm
#3
Thank you that helped I initially tried the proposed solution. I was just using the wrong key.
1 Like
clckr
June 5, 2019, 3:20pm
#4
Thank you so much! I have been fighting this for a week. Your answer solved the problem.