0

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?

user949286
  • 1,259
  • 1
  • 13
  • 22

3 Answers3

1

The host needs to be prefixed by "-r:" like so:

winrs -r:http://server:5985 -p:my password -u:user "dir"

0

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.

paddy
  • 60,864
  • 6
  • 61
  • 103
  • Unfortunately still no luck. Now I'm getting: The filename, directory name, or volume label syntax is incorrect. I assume because it's trying to interpret it as a command. – user949286 Jan 29 '14 at 04:15
0

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