Solved

Batch File Proccessing

Posted on 2009-07-14
3
277 Views
Last Modified: 2012-05-07
I have a master batch file that calls a sub batch file to to check OS version.  EX:
@Echo off
Echo Checking for Updates
Set SourceDrive=f:\backup
net use u: /delete
del \\JAXBACK02\f$\backup_logs\%ComputerName%.txt
del \\JAXBACK02\f$\backup_logs\%ComputerName%_rsync.log
net use u: \\jaxback02\u$\%computername%
Call \\jaxback02\f$\backup\os.bat

The sub batch file reads:


ver | find "Version 5.2" > nul
if %ERRORLEVEL% == 1 goto Win2k

:Win2k
Call "\\jaxback02\f$\backup\rsyncDc.bat"
goto theexit

Once the OS versions is determined to be Win2k then a nother script runs This all works well except after the sub batch file runs, the maaster batch file continues to process. I want all processing to stop once the sub is called.  
0
Comment
Question by:Akostech
3 Comments
 
LVL 2

Expert Comment

by:infoseccons
ID: 24849344
You could just use the EXIT command?
For instance check the errorlevel the os.bat sub batch returns and exit or not based on that?

"if %ERRORLEVEL% == nn EXIT"


0
 
LVL 82

Accepted Solution

by:
oBdA earned 125 total points
ID: 24849360
So os.bat should not return to the calling (master) bat?
That's rather simply to achieve: delete the "call" in front of the call to os.bat; without the "call", cmd.exe will not return to the calling batch:

@Echo off
Echo Checking for Updates
Set SourceDrive=f:\backup
net use u: /delete
del \\JAXBACK02\f$\backup_logs\%ComputerName%.txt
del \\JAXBACK02\f$\backup_logs\%ComputerName%_rsync.log
net use u: \\jaxback02\u$\%computername%
\\jaxback02\f$\backup\os.bat
echo This line will never be displayed if the batch file above exists.
0
 

Author Closing Comment

by:Akostech
ID: 31603242
that worked like a charm
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now