Run a script from the command line
Top  Previous  Next


1) Make sure that the file c:\hello world.cnu from the previous tutorial create and run a basic script exists

2) Open the command prompt
 
Start button / programs / accessories / command prompt.  

3) Go to the directory where AdmWin is installed

4) Run the script

At the command prompt type:  
 
admwin /sb "c:\hello world.cnu" /alldata  
 
Now you should see the same two messenger service dialogs as in create and run a basic script.  

5) View the log

At the command prompt type:  
 
type batch.log  
 
The file batch.log always contains the output of the latest job when a script is executed from the command line.  
 
As you can see it here says "All OK." - everything went fine.  
 
 

What if there is an error in a script that is executed through the command line?

SetupBatcher sets the %errorlevel% environment variable to a non-zero value when a script fails - if you call SetupBatcher from another program, first check %errorlevel%, if non-zero then check the contents of the batch.log file.  
 
It is also possible to perform any command when an error occurs by using the OnError section, see the previous tutorial how to execute commands when an error occurs.