Computing.Net > Forums > Windows Vista > End Batch File When There's No Netw

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

End Batch File When There's No Netw

Reply to Message Icon

Name: Roystreet
Date: August 29, 2007 at 00:05:37 Pacific
OS: Vista
CPU/Ram: P4
Product: Home made
Comment:

Hello,
I have a simple batch file that runs when I log into my laptop. It backs up files onto my server. But when I'm not on the same network or my server is off, the bat file just hangs trying to run. I user ROBOCOPY, which allows me to log the process. Of course the log simply shows that it's not connected and gets an error 53. Which is totally understandable...But how can I get the file to just end if it can't find a connection right in the beginning?
Thanks for your help,
Roystreet




Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: August 29, 2007 at 03:10:29 Pacific
Reply:

Depends on your setup, but you might get away with this (add before the copy):
net view server || exit /b


0

Response Number 2
Name: Roystreet
Date: August 29, 2007 at 13:27:39 Pacific
Reply:

My server is \\Roy\

So I would put in the bat file:

net view \\roy exit /b
robocopy C:\user \\roy\testfolder

exit

-------------
That way if the server is not found, go ahead and exit?
I'm not sure what the /b means.
Thanks.

roystreet


0

Response Number 3
Name: Razor2.3
Date: August 29, 2007 at 17:22:46 Pacific
Reply:

Here's the actuall logic of the command:
net view \\Roy - Let me see the shares on server Roy. (Optionally, you could use dir \\Roy\testfolder.)

Optional bit that I didn't use: >NUL 2>@1 - Don't care about the output.

|| - On error, run...

exit /b - Exit batch file (the /b).


0

Response Number 4
Name: Roystreet
Date: August 30, 2007 at 00:32:04 Pacific
Reply:

"Razor2.3" I greatly appreciate your help. It worked! I wasn't putting the "||" in the file & once I did, it started working much better.

You sure helped!
Have a great day,
roystreet


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Vista, no pci/modem recog... H2 Optimize HP Vista Note...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows Vista Forum Home


Sponsored links

Ads by Google


Results for: End Batch File When There's No Netw

New Computer For Vista www.computing.net/answers/windows-vista/new-computer-for-vista/364.html

batch file tweak help needed www.computing.net/answers/windows-vista/batch-file-tweak-help-needed/3941.html

Batch file questions www.computing.net/answers/windows-vista/batch-file-questions/5100.html