I am trying to get a batch file to run at start up that will map a drive to a computer that is directly connected through an Ethernt cable to another computer (shared folder).
1). I have manually mapped the drive in explorer.
2). I have created a batch file and if I run the batch file by double-clicking it, the batch file successfully maps a T: drive.
net use T: \\192.168.X.XX\ShareFolder /persistent:yes /user:username password
3). This computer has some security restrtictions on it by the vendor and I was told to place the batch file in a specific folder to have the batch file run at start up.
a. The batch file does not successfully map the drive.
b. Perhaps I should put a delay (Timeout 13) for 13 seconds and try it again.
4). I was given a batch file that other companies are using and I do not see a difference between the batch file except that a message will be displayed of it cannot find the other pc.
a. The other batch file is shown below :
set MyShare =*\\192.168.X.XX\ShareFolder*
%SystemRoot%\system32\ping.exe -n 1 %MyServer% >nul
if errorlevel 1 goto NoServer
echo %MyServer% is availabe.
rem set the username, domain and password here
net use *T*: %MyShare% /User:*Username* *Password* /y
echo %MyServer% is not availabe yet.
My questions are:
1). What are the differences between the 2 x Batch files?
a. The only think that I can see is that the other batch file has a '/y/ flag in the bet use command.
b, What does the '/y/ flag do in the net use command, in the other batch file?
2). Are there any other differences between the 2 x batch files so we can map a T: Drive?
3). Should I try a delay when my (original) batch file executes to make sure that the other services have been started.
a. Such as the network connectivity to the other computer?