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
    Posts
  • nlt6444
    Participant
    Post count: 13

    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
    Participant
    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, 11 months ago by  Buster. Reason: Formatting
  • nlt6444
    Participant
    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.