Index | -Menu(8)- | Errorlevel FIND | SORT | MORE | Batch



Batch (supplement)

Table of contents: 08.01 Exit codes 08.02 Special syntax       More examples on "my old Homepage" 09.00 ASCII table 10.00 Various 10.05 DEBUG Examples 11.00 Batch and Third-Party Programs 11.05 SED 14.05 STRINGS News Section
-Top-
 
                                                                            

8.01 Exit codes

       echo|find "E">nul   Errorlevel = 0  (Win9X/NT)
       echo|find "">nul    Errorlevel = 1  (Win9X/NT)
       CHKDSK              0, 255
       CHOICE              0,... 255
       CHOICE/>NUL         255
       %COMSPEC%/C         0
       DEFRAG              0,... 9
       DELTREE             0, 1
       DISKCOMP            0,... 4
       DISKCOPY            0,... 4
       FC NUL NUL>NUL      0
       FC NUL>NUL          1
       FIND                0,... 2
       REM|FIND ""         1
       FORMAT              0, 3, 4, 5
       KEYB                0, 1, 2, 4, 5
       MSAV                (NOT 86), 86
       REPLACE             0, 1, 2, 3, 5, 8, 11
       RESTORE             0, 1, 3, 4
       SCANDISK            0,... 4, 254, 255
       SETVER              0,... 14
       XCOPY               0, 1, 2, 4, 5
       XCOPY NUL NUL\>NUL  4

       Link: Get Errorlevel


8.02 Special syntax

 Pause (two seconds).
 If the batch is interrupted by the [Ctrl]+[C], or [Ctrl]+[Break]
 keys, it won't leave any 8+0 junk files in the TEMP environment.

     REM | %COMSPEC% /C choice /C:delay /T:d,2 > NUL
 or
     choice/T\,2/C\ wait >NUL<AUX


 Clear the screen. Change the current search PATH to drive C (root or TEMP)
 For %%c in (LS : D) do C%%c %temp%.\


  @Rundll32.exe User,ExitWindows


 Echoing %a%1, %a%2, b1 and b2.
 For %%v in (%a% b) do %comspec%/c For %%n in (1 2) do Echo %%v%%n


 :ÿ A blank line:(+bell)+Hello World+Pause+Jump 2 label ÿ
 For %%c in (Echo. Echo.HelloÿWorld Pause Goto:ÿ) do %%c


 What?
     1. Show: Hello World (on one line):
              an ASCII 255 character (ÿ) will be invisible (like space )
     2. Make: Sound. -- (ring the bell):
              the ECHO command + an ASCII 7 character()
     3. Show: Press any key to continue (Pause)
     4. Goto: Jump to label ÿ.

        For %%c in (Echo.HelloÿWorld Pause Goto:ÿ) do %%c
   Or:
        For %%c in (Echo.HelloÿWorld Pause Goto) do %%c ÿ
   Or:
        For %%c in (Echo.HelloÿWorld Pause Goto) do %%c ÿ
   Or:
        For %%c in ("Echo Hello World" Pause "Goto ÿ") do %%c




The following batch program is useful for a PANDA user. NOTE: ClipName.exe from "http://members.home.net/rbkweb/" is used. Some lines MUST be changed but I think that you can figure it out yourself. @Echo off Echo %1| Find/i "\PAV.SIG" >NUL If not errorlevel 1 Goto 1B. Echo. Echo Choose: 1. Download updated files (PAV.SIG) Echo 2. Update the system Echo 3. Run Panda Antivirus Echo 4. Read the e-mail from Panda Software Echo 5. Make a "virus infected" test file (%temp%.\Eicar.com) Echo 6. Quit. Choice /c123456/n If errorlevel 6 For %%c in (Cls Exit) do %%c If errorlevel 5 Goto Test If errorlevel 4 Goto E-mail If errorlevel 3 Goto Run If errorlevel 2 Goto Update :Download %windir%\Desktop\ClipName.exe "USER-ID PASSWORD" Cls Echo. Echo. If you remember the following: Echo. Echo. Press [Shift+Insert] Echo. Click [Bottom of picture] Echo. Click [date] Echo. Echo.Then Pause Start http://updates.pandasoftware.com:8003/updates/acti_inter.htm For %%c in (Cls Exit) do %%c :Update If exist PAV.SIG Goto 1A For %%c in (Cls Echo. Echo.˙Drag˙&˙drop˙the˙PAV.SIG˙file˙from Echo.) do %%c Echo. http://updates.pandasoftware.com:8003/updates/acti_inter.htm For %%c in (Echo. Echo.˙to˙the˙icon˙of˙this˙batchfile. Echo. Echo. Pause Cl s Exit) do %%c :1A Move PAV.SIG %windir%\System\PAV.SIG Goto 2AB :1B Move %1 %windir%\System\PAV.SIG :2AB Echo. Echo F|Xcopy/V %windir%\System\PAV.SIG "C:\Programmer\Panda Software\Panda Antivirus 6.0\" >NUL For %%c in (Echo. Echo.Updated. Echo. Pause Cls Exit) do %%c :Run "C:\Programmer\Panda Software\Panda Antivirus 6.0\Pavw.exe" For %%c in (Cls Exit) do %%c :E-mail Cls Echo. From: techsupport@pandasoftware.es Echo. To: YOUR EMAIL ADDRESS Echo. Sent: DATE Echo. Subject: Panda Antivirus Echo. Echo. Dear client, Echo. Echo. As a registered Panda Software user, you are entitled to Echo. access UPGRADES for our antivirus through our website Echo. (http://updates.pandasoftware.com:8003/updates/acti_inter.htm) Echo. These are available for the following products: Echo. Echo. Panda Antivirus Platinum Echo. Echo. Your user identification is "USER-ID" and your password "PASSWORD" Echo. Echo. For all enquiries, use your client number "CLIENT NUMBER". Echo. Echo. Panda Software. Echo. The only antivirus Company in the world that provides you with techni cal Echo. support personnel 24hours a day, 365 days a year and daily updates. For %%c in (Echo. Echo. Pause Cls Exit) do %%c :Test Echo.X5O!P%%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*> %temp%.\Eicar.com Cls :: End of freeware batch program which I found on "http://2dos.homepage.dk"
Test your batch knowledge. What's output? @Echo off For %%c in (Set Echo.c>c ) do %%c=c=c Echo. For %%c in (Type Echo.[%c%]) do %%c=c Pause For %%c in (Set Del Cls) do %%c c= Lesson 2 Rem Not a Friday: :: Used - Danish Win9x and STRINGS.COM @Echo off Strings c=left %temp%c:,2 For %%c in (%c% "Cd %temp%\" "Set c=") do %%c %comspec%/c For %%v in (1 2) do Prompt If %%9'==' %%0 $d 3 4 5 6 7 8 9$_Dat e %%2$_|Find/v "$">~Date.bat :~Date Strings /p^ mm=Ask What date? (4 digit, ddmm):  For %%v in ("DD=Left" "MM=Right") do Strings /p^ %%v %mm%^2 Rem * Must not be a Friday. For example Monday, January 10: Echo.|Date 10-01-2000>NUL Echo.|Date %dd%-%mm%-2000>NUL Echo.|Date|Find "Fre">NUL If errorlevel 1 For %%c in ( Echo Call Goto ) do %%c ~Date %dd%-%mm%-2000 i s not a Friday. For %%v in (dd mm) do Set %%v= For %%f in (Call Del) do %%f ~Date.bat For %%c in (Echo. Echo.YES!ÿThat'sÿaÿFriday. Pause Cls) do %%c
-Top- | Errorlevel FIND | SORT | MORE | Batch