Using $dirfiles variable with -Parameters

//Using $dirfiles variable with -Parameters
Using $dirfiles variable with -Parameters 2015-05-27T16:06:52+00:00

The Toolkit Forums General Using $dirfiles variable with -Parameters

  • Author
  • nlt6444
    Post count: 13
    #258 |

    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\ /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
    Post count: 19

    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.

    • This reply was modified 2 years, 7 months ago by  Buster. Reason: Formatting
  • nlt6444
    Post count: 13

    Thank you that helped I initially tried the proposed solution. I was just using the wrong key.

You must be logged in to reply to this topic.