|
Answer» Create a .bat file on Windows and a .sh file on Unix that does the following
- takes one argument, - if the argument = 1, then display the MESSAGE "this is the FIRST argument" - if the argument = 2, then display the time of DAY - if the argument = "last", then run another script that effectively counts from 1 to 10 using a FOR loop
this is my script, but it is not working. The argument last, i dont how to create script on this also that counts 1 to 10, please help
ECHO off cls
:start ECHO. ECHO 1. Display this is the first argument ECHO 2. Display the time of day ECHO last. Run other script set choice= set /p choice=Type the argument to print the output. if not '%choice%'=='' set choice=%choice:~0,1% if '%choice%'=='1' goto argument if '%choice%'=='2' goto time_day if '%choice%'=="last" goto run_script ECHO "%choice%" is not valid please try again ECHO. goto start :argument ECHO this is the first argument goto end
:time_day ECHO |TIME| goto end
:run_script CALL C:\WINDOWS\NEW_BATCHFILE.BAT goto end :end
please help
Quick and ugly:
set n=1
:Start echo %n% if %n%==10 goto Done if %n%==9 set n=10 if %n%==8 set n=9 if %n%==7 set n=8 if %n%==6 set n=7 if %n%==5 set n=6 if %n%==4 set n=5 if %n%==3 set n=4 if %n%==2 set n=3 if %n%==1 set n=2 goto Start
:Done
|