Solved

Batch File Proccessing

Posted on 2009-07-14
3
290 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 83

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 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

15 Experts available now in Live!

Get 1:1 Help Now