Reputation: 1279
I'm trying to call WinRS for some of our automated scripts. I've run into an issue when attempting to pass a password with spaces for the -p argument.
For example,
winrs http://server:5985 -p:my password -u:user dir
fails with the message
winrs.exe:The parameter is incorrect.
Quoting the argument doesn't seem to help,
winrs http://server:5985 -p:"my password" -u:user dir
it fails with the message
Winrs error:Access is denied.
If I type in my password, everything works as expected, however this is not an option for the workflow we're building.
Is it possible to pass a password containing spaces to WinRS? If not, is there a workaround that does not include manual typing?
Upvotes: 0
Views: 3279
Reputation: 1
Try using the caret escape character. I believe one of the following combinations might work:
winrs http://server:5985 ^"-p:my` password^" -u:user dir
or
winrs http://server:5985 -p:^"my` password^" -u:user dir
Courtesy of https://www.drupal.org/node/1242152
Upvotes: 0
Reputation: 11
The host needs to be prefixed by "-r:" like so:
winrs -r:http://server:5985 -p:my password -u:user "dir"
Upvotes: 1
Reputation: 63481
Try using a backtick before the space. The backtick is powershell's escape character:
winrs http://server:5985 -p:my` password -u:user dir
This should prevent the space from being interpreted as a delimiter.
Upvotes: 0