Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Batch File Proccessing

Posted on 2009-07-14
3
Medium Priority
?
327 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
[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
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 85

Accepted Solution

by:
oBdA earned 500 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

719 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