Solved

Errorlevels???????

Posted on 1998-05-27
7
521 Views
Last Modified: 2013-12-23
Ok. For 30 points:

Who can tell me the method for testing for a successful connection to a network drive from within a DOS batch (.bat) file.

That is I want to cater for the failure of something similar to the following:

IF NOT EXIST x:\directory NET USE x: \\Share\directory

Any suggestions.............?????????????
0
Comment
Question by:rigsby
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 7

Accepted Solution

by:
BlackMan earned 30 total points
ID: 1548829
Try:
NET USE X: \\server\share
IF ERRORLEVEL 1 GOTO NOTCONNECTED
bla
bla
GOTO DONE
:NOTCONNECTED
ECHO Error
:DONE
0
 

Author Comment

by:rigsby
ID: 1548830
BlackMan:  Have tried this with no success....but thank you for your response!!
0
 
LVL 7

Expert Comment

by:BlackMan
ID: 1548831
That's weird, i use the excatly same thing in a loginscript (on NT) and it works like a charm?
I'll see if i can dig another solution up for you - is it for use in loginscripts?
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

Author Comment

by:rigsby
ID: 1548832
Even with IF ERRORLEVEL 1....etc I receive the following error which is redirected to a log file.

Error 88: An error occurred while data was being written to the disk. Data
might have been lost. Ensure that the disk you want to write to has enough
space available, and that you have write permission for the file, and then
try again.

It appears that the IF statement has no effect. I try it with an available network drive and then with the same drive made un-available. Yes I have used...IF ERRORLEVEL 0 and yes it works but on both....you just can't win can you :-)

Does this help
0
 
LVL 7

Expert Comment

by:BlackMan
ID: 1548833
It could be because Win95 tries to write the log file on a networkdisk. Try to put a C:\ in the start of your BAT file to assure that you are on a local drive. If the BAT file runs as a loginscript, you will have to do that trick
0
 

Author Comment

by:rigsby
ID: 1548834
BlackMan: Your assistance IS very much appreciated!!!!!!

I have tried placing a c:\ at the start (or before the NET USE command) and got ERROR 50. Basically saying that the action is not available from my computer.

The bat file in question is not part of any login script but is a stand alone routine for performing back-up.

Any more ideas?
0
 
LVL 7

Expert Comment

by:BlackMan
ID: 1548835
Could you post a few more lines (or all) of you BAT file? It might help..
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Downtime reduced, data recovered by utilizing an Experts Exchange Business Account Challenge The United States Marine Corps employs more than 200,000 active-duty Marines with operations in four continents, all requiring complex networking system…
This article is in response to a question (http://www.experts-exchange.com/Networking/Network_Management/Network_Analysis/Q_28230497.html) here at Experts Exchange. The Original Poster (OP) requires a utility that will accept a list of IP addresses …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question