0

Calling

net use F: \\my\destination\folder /user:myuser password

works fine.

When in a Batch file, it says "System error 86" ( = wrong password)

How can this be ? Is the batch file somehow encoded differently ?

Tim
  • 3,910
  • 8
  • 45
  • 80
  • I only guessing. Your password contains a percent sign, in a batch file you need to double it, `my%pwd` becomes `my%%pwd` – jeb Oct 06 '15 at 12:54
  • Another question, why do you need this? Couldn't you use `/persistent` then you don't need to store your password in a batch file at all – jeb Oct 06 '15 at 12:59

1 Answers1

2

Found it:

setlocal disabledelayedexpansion

did the trick

The password contained a "!" and somehow had to be escaped.

The weird thing is that during this hour of desperate testing, we came across some strange effects that were probably caused by windows caching network passwords (at least we came to this conclusion)

Tim
  • 3,910
  • 8
  • 45
  • 80