New
#1
NET USE in a batch file- sometimes works
Windows 10 Pro
I have a batch file where I map my net devices, mostly Samba shares from my Linux servers.
(I know you don't like to see snippets, but the bat file is over 300 lines long.)
Basically, I have a function for each drive to be mounted:
At least one of the drives, seemingly at random, will give me a "name not found" error or a "System Error 5" (AKA. BSOD for NET), but when I open a CMD window and manually enter the net use line, it works. Sometimes simply repeating the bat file corrects the problem.Code::mntXrem Shared folder on NUCIF EXIST "x:\" goto xXnet use x: \\nuc4\hshare /user:nuc raspberry /yIF %ERRORLEVEL% EQU 0 goto xXrem Try deleting the map and try againnet use x: /d /y >NULnet use x: \\nuc4\share /user:nuc raspberry /ysleep 1s:xXgoto:eof
Can anyone suggest why running the net use from a bat file could fail when the same net use in a cmd window connects just fine?
<And how do I properly post code?>