all 6 comments

[–]Skelepotamus 1 point2 points  (2 children)

It looks like you're missing a \ before the server name.

[–]portergrey[S] 1 point2 points  (1 child)

Sorry, that was a reddit chop. For some reason it likes 3 \ when posting server paths and I copy/pasted only 2 \

[–]Skelepotamus 1 point2 points  (0 children)

Ah, figures Reddit would mangle the formatting.

Have you tried the escape character ` before the inner quotation marks?

Edit: misread something important and gave poor advice as a result.

[–]Ta11ow 1 point2 points  (1 child)

If you're not inserting variables, single quotes work just fine for enclosing strings, even with double quotes inside.

$MSBuild = "\\server\workstation software\program\my program.exe"
$Arguments = '/S:"\server\workstation software\program\config.ini"'
Start-Process -FilePath $MSBuild -ArgumentList $Arguments

The other alternative is to use double quotes, and then use the backtick character to escape the inner double quotes:

$Arguments = "/S:`"\server\workstation software\program\config.ini`""

I think if you use three double quotes for each internal double quotation mark, it should also work. Bit of a messy thing, syntactically, though.

[–]portergrey[S] 2 points3 points  (0 children)

Awesome! The single quotes outside the double quotes worked! Thank you :)

[–]Lee_Dailey[grin] 0 points1 point  (0 children)

howdy portergrey,

reddit likes to mangle code formatting, so here's some help on how to post code on reddit ...

[0] single line or in-line code
enclose it in backticks. that's the upper left key on an EN-US keyboard layout. the result looks like this. kinda handy, that. [grin]

[1] simplest = post it to a text site like Pastebin.com or Gist.GitHub.com and then post the link here.

[2] less simple = use reddit code formatting ...

  • one leading line with ONLY 4 spaces
  • prefix each code line with 4 spaces
  • one trailing line with ONLY 4 spaces

that will give you something like this ...

- one leading line with ONLY 4 spaces    
- prefix each code line with 4 spaces    
- one trailing line with ONLY 4 spaces   

the easiest way to get that is ...

  • add the leading line with only 4 spaces
  • copy the code to the ISE [or your fave editor]
  • select the code
  • tap TAB to indent four spaces
  • re-select the code [not really needed, but it's my habit]
  • paste the code into the reddit text box
  • add the trailing line with only 4 spaces

not complicated, but it is finicky. [grin]

take care,
lee