Solved

Batch File Proccessing

Posted on 2009-07-14
3
321 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 84

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

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…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

751 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