11

I have this command in batch script

net use \\192.168.40.40 /user:192.168.40.40\Administrator b91A*9AIvPr%

But when it runs I get the error System error 1326 has occurred.

The user name or password is incorrect.

Because it strips off last % symbol Putting password in "" doesn't help either.

I cannot change password for the account. So are there any workaround?

2
  • 12
    I hope that's an example password and not the real one. If it's the real one, and you can't change it, you're probably going to be in a bit of trouble...
    – Keiji
    Jan 30 at 7:55
  • at first this is modified password not real, second that IP is local IP not public so even the password was real it is not useful
    – xinkala
    Jan 31 at 12:20

1 Answer 1

22

There are a few solutions to your problem

  1. Use a variable for the password
    set "password=b91A*9AIvPr%"
    net use \\192.168.40.40 /user:192.168.40.40\Administrator %password%
  1. Use a special character escape sequence. Use a double percent symbol:
    net use \\192.168.40.40  /user:192.168.40.40\Administrator b91A*9AIvPr%%
  1. Escape the quotations with ^:
    net use \\192.168.40.40  /user:192.168.40.40\Administrator ^"b91A*9AIvPr%^"
2
  • I can't test it now because I don't have a Windows machine at hand , but I've got a feeling that your 2nd solution %% will literally insert 2 % signs in the password. Escaping the " in the 3rd one may actually pass through the " as part of the password. Escaping the % by using a ^ aka: ˆ% is another option and to me is more logical than either your 2nd and 3rd suggestion.
    – Tonny
    Jan 31 at 13:01
  • %% version works :В
    – xinkala
    Jan 31 at 13:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.