'Windows Batch File - Net Use encounter "System Error 64"
Been encountering this error "System error 64 - the specified network name is no longer available" in one of my windows batch script while trying to NET USE \server\drive\folder to connect to a network folder.
However, when I re-run the script, the Net Use command executed successfully and is able to map to the network folder. These issue seems to happen only on the first run, as subsequent re-run were able to complete successfully.
The code that cause the err:
net use \\qserver\adrive\RAG\SQR /persistent:yes System error 64 has occurred.
The specified network name is no longer available.
Anyone has any idea why this is happening? Seems like 1st run of script failed but subsequent runs are able to complete successfully.
In addition, was wondering if there are any err handling techniques that can detect this err and use some scripting to force a re-run.
Something like:
IF (System Error 64 occurred) {
//Do a re-run
net use \\qserver\adrive\RAG\SQR /persistent:yes
}
Thanks a lot for the help. Pls advise based on above!
Solution 1:[1]
See if this helps: if the network is not up it will loop indefinitely, which may not be what you want. It depends on your situation.
:check
if not exist "\\qserver\adrive\RAG\SQR\" & timeout /t 10 & goto :check
net use \\qserver\adrive\RAG\SQR /persistent:yes
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | foxidrive |