troubleshooting Question

What is the difference between these 2 batch files.

Avatar of Pkafkas
Pkafkas asked on
Microsoft DOSWindows OSWindows Batch
16 Comments1 Solution131 ViewsLast Modified:
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 MyServer=*192.168.X.XX*
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
goto :EOF
echo %MyServer% is not availabe yet.
Timeout 10
goto :EOF

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?
Join our community to see this answer!
Unlock 1 Answer and 16 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 16 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros