Link to home
Start Free TrialLog in
Avatar of rakkad
rakkadFlag for United Kingdom of Great Britain and Northern Ireland

asked on

DOS batch script which makes use of a call function to call another batch script

I need a DOS batch script which calls another batch script, but need conditions in the script to make sure:-

1) the script calls the other batch script successfully
2) the script exists if the script fails

Thanks
Avatar of Qlemo
Qlemo
Flag of Germany image

@echo off
if exist OtherBatch.cmd  (
  call OtherBatch.cmd || echo This is an error
) else (
  echo Script not found
)

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Crossed posts there with Qlemo of course... basically the same difference but I laid mine out a bit more wordily to show you other options.

Steve
Avatar of rakkad

ASKER

This task worked
Why just a B grade?
Why only Steve got points (and why a "B" grade only)? Both solutions are comparable and without much of a difference.