Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 5 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Keep in mind... Using double-quotes in "/2/Y" it will think the slash is a part of a escape code. To prevent the error you need to use the single-quote in order to accept special characters in the string.
That's why JVierra made the correction from "/2/Y" to use single-quotes '/2/Y'.
Actually I always convert double to single when posting code. I try to entice others to do the same for the reasons Max has noted.
My solution has one error. There should be a space between the two parameters.
Start-Process $dataup -ArgumentList '/2 /Y'
Some commands don't handle switch parameters correctly.
The users original line Start-Process $dataup "/2 /Y" should have worked. "/2" and "/Y" are not meta characters in PowerShell. PowerShell uses the baqtic character as an escape.
Try it at a prompt:
"/2 /Y" will return unchanged.
"`r`n" will return control characters.
Here is a list of all escaped characters and their meaning: https://ss64.com/ps/syntax-esc.html
One issue with the post is that single and double quotes are their own escapes. 'This '' is a single quote' "This "" is a double quote"
This topic is 5 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.