ERROR: Arg0 : The term ‘Arg0’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
ERROR: included, verify that the path is correct and try again.
so my question: how can I put that line into a here-string to be able to successfully create my file? What is the correct syntax?
js is taking a guess, but what is $arg or $args? You need to be careful as ‘args’ is a Powershell keyword. Are the arguments you are inputting space delimited? Here are two methods, which using method 2 is better as you will get errors if the XML is malformed vs method 1 is just manipulating it as text:
i created my here-string with a single-quote instead of double-quote and it works as expected now. sorry to have bothered you.
$hereString = @’
some text…
<Arguments>$(Arg0) $(Arg1) $(Arg2)</Arguments>
more text
'@
Note: it’s funny though to see that you totally missed the point by automatically assuming i was passing arguments to a script when I only tried to write the entire here-string to a file.
Unfortunately, assumptions need to be made when only a portion of the code is provided. The error posted indicates the $arg0 variable is not defined and that variable definition was not provided in the post and your provided example has double qoutes. Glad you figured out the issue.