BATCH Scripting language commands and explanations, syntax, as well as examples and uses! Second Edition 0.0 Introductions 0.1 Introducing: BATCH Scripting 0.2 Prerequisites for BATCH 0.3 How this document is annotated 1.0 Simple stuff 1.1 Displaying text 1.2 Reading a file 1.3 Writing to a file 1.4 Screen functions 1.5 Pausing execution 1.6 Slowing execution 1.7 Making random numbers 2.0 Advanced stuff 2.1 IF THEN statements 2.2 SET statements 2.3 Displaying variables 2.4 Using variables 2.5 Encoding and decoding files 2.6 Label statements 2.7 GOTO statements 2.8 Detecting key presses 2.9 Looping programs 3.0 Professional stuff 3.1 Selective randomization 3.2 CALL statements 3.3 Pinging internet locations 3.4 Opening applications 4.0 Examples 4.1 Simple examples 4.2 Advanced examples 4.3 Professional examples 5.0 Legal stuff 5.1 Copyright 5.2 Legal rights 5.3 Document information 6.0 New discoveries 6.1 Sleep timers 6.2 Calling external scripts 6.3 Instant input 6.4 More colors 6.5 Variable slicing 6.6 Bell character 6.7 File operations 6.8 Getting arguments 6.9 Terminal size 7.0 System variables 7.1 OS version 7.2 System time 7.3 Other variables Section 0.0 - Introductions Part 0.1 - Introducing: BATCH Scripting So you want to learn how to BATCH like a pro, huh? Well, don't worry, that can be arranged easily! If you follow the instructions in this document, you will see just how easy it really is to learn and begin to use BATCH Scripts! First off, BATCH is what is called a Scripting language or a Shell language because of it's limitations and simplicity as compared to other languages such as BASIC, FORTRAN, or any of the C languages. Why should you learn BATCH? Because of a few simple reasons: -Small files compared to Java or any C language -Much easier to learn to program professionally -Simple commands that can do many things at once -Performance is not affected much by sloppy or non-linear programming -And to top it all off, a massive user base and no extra required installs! Part 0.2 - Prerequisites for BATCH Well, this IS batch we're talking about here, so there aren't really that many requirements, really just any Windows computer made in 2003 or later should be just fine, but some things require Windows 7 or later, others only require Windows 2000, and so forth. Sections that have special requirements will have an annotation explaining what you need and why. The only real suggestion I can give for requirements is probably something like the following, though there are certainly a lot of exceptions: -Intel Pentium 4 1.8GHz or faster -256MB or more RAM -2GB of free uncompressed hard disk space -Microsoft Windows XP Home Edition Service Pack 2 or later -Any speed internet connection You may also want to acquire the famous Notepad++, and set it to BATCH language mode, as it really does help out quite a lot when you need to find mistakes in your programs, as it helps by highlighting commands and stuff with colours and highlighters to allow you to see the words easier. Part 0.3 - How this document is annotated This document will (hopefully) be more organized than the TextEngine 0.1 to 1.4 README.TXT files were written, so I'll be sure to add plenty of annotation types in so you can tell exactly what you're doing when and where. Annotations are explained below: -When a section is annotated as +text+, it means that there are some extras you might want, and explains why you might want them. -When a section is annotated as (text), it means that you should insert some text here without the parentheses, obviously. -When a section is annotated as [text], it means that you should insert a variable here, without brackets. -When a section is annotated as {text}, it means that you should insert another command here, without brackets. -When a section is annotated as , it means that I have made a mistake in my typing, as per usual operation. Section 1.0 - Simple stuff IMPORTANT! You MUST put @ECHO OFF then ECHO OFF at the beginning of every BATCH script otherwise you will get a broken terminal! ECHO. May be used to invoke a line break, and MUST be used both BEFORE AND AFTER displaying the contents of a document on screen! EXIT must be used at the END OF A PROGRAM OR WHEN EXITING A PROGRAM ONLY! Part 1.1 - Displaying text Displaying text in BATCH can be done in one of two ways - direct or variable. When using variable, you display the value of a selected variable, and when using direct, you display the exact typed text. Here are some examples of each: -ECHO (write something to display here) -ECHO %[put your variable here]% -ECHO (write something to display here)%[put your variable here]* Part 1.2 - Reading a file Reading files in BATCH is done using the TYPE command, and it displays the ASCII contents of any file. Here is an example: -TYPE C:\Windows\WIN.INI Which displays the contents of a file on drive C in the folder Windows called WIN.INI. You can also use variables in these commands, as shown here: -TYPE C:\TE_RA\%GAME%\%TYPE%.MON This displays the contents of the file on disk C in a folder called TE_RA, then another folder with the same name as the %GAME% variable, and then a file with the same name as %TYPE% with .MON added to the end. Part 1.3 - Writing to a file Writing to a file in BATCH is extremely easy as compared to most other programming languages using complex commands to achieve what can be done simply in one line of code in BATCH. Here is an example: -ECHO (write something here) >> (put the file directory here) -ECHO Hello World! >> C:\HELLO.TXT This file can then be viewed and edited in much the same way as any other normal text document. Part 1.4 - Screen functions This section is mostly a combination of other commands dealing with the terminal window, and allows you to modify the data displayed in it easily. The first of these commands is COLOR, which changes the colours of the screen accordingly with a 16 colour palette described in hexadecimal to change the background and foreground colours of the terminal window. Here is the syntax of the COLOR command: -COLOR (background colour)(foreground, or text, colour) -COLOR %[background variable]%%[text variable]% As always, the operators for the command can be changed using variables. Here are some more examples: -COLOR 0A -COLOR 40 -COLOR %A%%B% -COLOR %BG_C%%TX_C% Here is a table of the colors available for use: 0 = Black 8 = Gray 1 = Blue 9 = Electric Blue 2 = Green A = Lime green 3 = Aqua B = Light Aqua 4 = Red C = Light Red 5 = Purple D = Light Purple 6 = Yellow E = Light Yellow 7 = White F = Bright White Colour tables such as this one are EXTREMELY useful when programming with colours, as they help to assure you that you get it right on the first try. To clear the terminal window's display area, you just type a simple 3-letter command like: -CLS -CLEAR Of course, this command has no operators so you can leave it as is. Part 1.5 - Pausing Execution Pausing program execution in BATCH is simple, here is an example: -PAUSE You can also type >NUL after PAUSE to allow for custom text instead of the standard "Press any key to continue...". Here is an example: -ECHO Press any key to return to the menu... -PAUSE>NUL These commands are very important when programming in BATCH, as it can help you debug your programs easily by stopping every command. Part 1.6 - Slowing execution +Windows 7 or later is REQUIRED for this to work, so bear that in mind!+ Slowing execution in a BATCH program is easy, here's the syntax for that command: -TIMEOUT (number of seconds to wait) > NUL -TIMEOUT %[number of seconds variable]% > NUL Here are some real world examples: -TIMEOUT 0.5 >NUL -TIMEOUT %s% >NUL This command only works in Windows 7 or later, so keep that in mind when programming with this command. Part 1.7 - Generating random numbers Generating random numbers in BATCH uses the SET command with the /A (math) switch to allow a variable to be set to a random value. Here's an example: -SET /A RANDOM=%RANDOM% Doing this will generate a random number from -32767 to 32768. Later on, I will show you how to dictate what numbers actually go through, as there is no way currently to change what numbers are generated in BATCH. Section 2.0 - Advanced stuff Part 2.1 - IF THEN statements I'll just give the syntax and a few examples for this command, as I would prefer not to explain for hours what it does and how you can use it, and I'm sure that you don't want to read that either. Here's the syntax: -IF %[variable to compare]%==(variable or number to compare to) THEN {commands go here} -IF %MENU%==0 THEN GOTO DEBUG If a number is greater than another: -IF /I %[variable to compare]% GTR (variable or number to compare to) THEN {commands to perform} -IF /I %CFA% GTR 16384 THEN GOTO MENU If a number is smaller than another: -IF /I %[variable to compare]% LSS (variable or number to compare to) THEN {commands to perform} -IF /I %CFA% LSS 2048 THEN GOTO MENU Part 2.2 - SET statements Setting variables is easy. Use /A to do math, and /P to take user input: -SET /P USER=?= -SET /P %[variable to change]%=(text to display to user) -SET /A PHP=%PHP%-%MATK% -SET /A %[variable to change]%=(math equations or including numbers or variables) Part 2.3 - Displaying variables This is done with the ECHO command: -ECHO %[variable to display]% -ECHO %PHP% -ECHO You're HP has dropped to %PHP%! Part 2.4 - Using variables I just explained this... Part 2.5 - Encoding and Decoding files This is surprisingly easy to do in BATCH! When a file is encoded, this is the syntax: -COPY (address of file to be encoded) (address to encode to) All you need to do in BATCH is change the file name and extension and you have encoded a file enough that normal users will not be able to open them! When decoding a file use this syntax: -COPY (encoded file address) (temporary folder) Just copy the file to a temporary folder with the original file extension (name does not matter) and delete it when you are done! Part 2.6 - Label statements Label statements are done as follows: -:(label name) Label names cannot contain spaces or the following characters: :, ;, &, %, #, $, @, /, \, >, <, | Part 2.7 - GOTO statements GOTO a label. Syntax: -GOTO (label name, no colon) Part 2.8 - Detecting key presses See Part 2.2 - SET statements. Part 2.9 - Looping programs To loop your program or a specific section of it, GOTO the same LABEL at the end of that LABEL section. Section 3.0 - Professional stuff Part 3.1 - Selective randomization Selective randomization in BATCH is actually one of the more difficult things to do, as you constantly have to generate numbers until one goes through. There are 2 ways to achieve this,and neither really works well in my experience, sometimes they can either be unreliable or in the case of one of these two methods just plain slow. The first method is to do something like this: -:RANDOMIZER -SET /A %[variable to randomize]%=%RANDOM% -IF /I %[variable again]% GTR (max number +1) GOTO RANDOMIZER -IF /I %[variable again]% LSS (min number -1) GOTO RANDOMIZER -GOTO (wherever you use this number) The other of these two methods looks something like this and is longer, but generally is much faster and unreliable in some cases. -:RANDOMIZER -SET /A %[variable]%=%RANDOM% -IF /I %[variable]% LSS 1024 GOTO (code) -IF /I %[variable]% LSS 2048 GOTO (more code) -IF /I %[variable]% LSS 4096 GOTO (even more code) -IF /I %[variable]% LSS 8192 GOTO (wow more code) -IF /I %[variable]% LSS 16384 GOTO (darn man how much code you got) -IF /I %[variable]% LSS 32768 GOTO (lots of code) -GOTO RANDOMIZER It is EXTREMELY IMPORTANT that you put the smallest number first, otherwise the sequence won't work properly and will skip all later code. Like I said, these are NOT fun to deal with, but they have to be done sometimes and I understand that (I'm FAMICOMASTER from the TextEngine team!) so I've tried to give you the best examples I could come up with here. Part 3.2 - CALL statements CALL statements are as follows and allow you to run another BATCH inside a the current BATCH window, but do not allow you to exit to the previous file. -CALL (location of BATCH file) Part 3.3 - Pinging internet locations To ping an internet location, do the following: -PING (address) (time) (ping size) Part 3.4 - Opening applications to open an application, do the following: -OPEN (location of application) (location to run from) Section 4.0 - Examples Part 4.1 - Simple example A basic example on using all of the SIMPLE commands we learned earlier: @ECHO OFF ECHO OFF CLS COLOR 0A ECHO Hello World! ECHO Hello World! >> C:\TXT.TXT ECHO. TYPE C:\TXT.TXT ECHO. ECHO PRESS ANY KEY TO GO ON... PAUSE>NUL SET /A RAND=%RANDOM% ECHO %RAND% ECHO PRESS ANYTHING TO LEAVE... PAUSE>NUL EXIT Part 4.2 - Advanced example A more advanced example using all of the ADVANCED commands we learned earlier: @ECHO OFF ECHO OFF CLS COLOR 40 :LOOP ECHO 1 2 OR 3? SET /P USER=?= IF %USER%==1 GOTO RIGHT IF %USER%==2 GOTO WRONG IF %USER%==3 GOTO WRONG IF %USER%==4 GOTO CHEAT GOTO LOOP :WRONG ECHO YOU GOT IT WRONG TRY AGAIN! GOTO LOOP :CHEAT ECHO YOU CHEATED! TRY AGAIN! GOTO LOOP :RIGHT CLS ECHO YOU GOT IT RIGHT! CLS ECHO YOU GOT IT RIGHt! CLS ECHO YOU GOT IT RIGhT! CLS ECHO YOU GOT IT RIgHT! CLS ECHO YOU GOT IT RiGHT! CLS ECHO YOU GOT IT rIGHT! CLS ECHO YOU GOT It RIGHT! CLS ECHO YOU GOT iT RIGHT! CLS ECHO YOU GOt IT RIGHT! CLS ECHO YOU GoT IT RIGHT! CLS ECHO YOU gOT IT RIGHT! CLS ECHO YOu GOT IT RIGHT! CLS ECHO YoU GOT IT RIGHT! CLS ECHO yOU GOT IT RIGHT! CLS GOTO RIGHT EXIT Part 4.3 - Professional example Yeah, I'm not typing this. If you REALLY WANT a professionally made BATCH example program, feel free to snoop around in the old TextEngine 1.43A or Journey v1001b source. If you read this document all the way through, you should understand most of it anyways. Section 5.0 - Legal stuff Part 5.1 - Copyright BATCH belongs to Microsoft This document belongs to AiO Systems Design Example content in this document may be copied and reused whenever and wherever. Part 5.2 - Legal rights BATCH belongs to Microsoft, and AiO Systems design CEO FAMICOMASTER created this entire document. Part 5.3 - Document Information Document finished: 2/27/2018 9:00AM Document author: FAMICOMASTER Document computer: D630 Document title: BATCH explanations Document type: TXT ASCII text file Document program: NotePad++ v7.4.2 Document OS: Microsoft Windows Media Center Edition 2005 Document subject: BATCH language command explanations for amateur programmers Document size: 29101 Section 6.0 - New discoveries Part 6.1 - Sleep timers There are many ways to create small delays in a Batch script, as we now know. The first to come to mind is the well known PING method, which is not particularly accurate, and can cause problems with computers not connected to a network. The next is TIMEOUT, which was explained previously. Finally, we come to the new method, which involves calling an external script in the same directory, called SLEEP.VBS, which will allow more accurate delays. Here are the contents of SLEEP.VBS: ms = WScript.Arguments(0) WScript.Sleep ms It's simple enough, and to use it in the terminal, we use the following syntax: -CSCRIPT SLEEP.VBS [D] >NUL Where the variable "D" is the delay in milliseconds (thousandths of a second). Here are some examples: -CSCRIPT SLEEP.VBS 500 >NUL -CSCRIPT SLEEP.VBS 2000 >NUL -CSCRIPT SLEEP.VBS 50 >NUL These will insert a .05, .5 and 2 second delay in between the commands before and after it. As you can imagine, this is extremely useful, since it will work under any of the Windows NT shells, and doesn't require any external additions to be installed. This script can be easily extracted from the main program anyways if it is not present - and easily deleted afterwards. Part 6.2 - Calling external scripts There are many reasons you may want to call an external script, and even more on why you might want to return to the original script afterwards. This can be useful in situations where you need something done but you don't want to clutter up a particular secton of your program with unneeded lines, or to use in multiple sections of the program that may need it. This can also be useful for situations where you may need to create temporary information for configurations or save data for later use. You can also perform simple communications between programs with them - but we won't get into that in this document. Maybe if it's requested. The first and most common way to do this is to use CALL to open up another script. It's syntax is simple enough: -CALL [File] [Args] Where the variable "File" is the location and name of the file you want to open. The variable "Args" is simply whatever data you wish to pass over to the external script which you are opening. Part 6.3 - Instant inputs +Requires Windows 7 or later!+ Instant inputs are the dream of every batch scripter that I know, and I can understand where they're coming from. It's a coveted feature that seemed impossible to reach, limiting the genres of games heavily, forcing simpler and more turn based games, but this could change all of that very quickly. To use this, you use the following syntax: -CHOICE /C [Buttons]>NUL Where the variable "Buttons" is a string of every keyboard character you may want to read. This will set the batch errorlevel to the character index of the button in the string that was pushed, and make a beep sound if an invalid button was pressed and refuse input. This can make menus and even gameplay much easier sometimes, depending on the situation. To read which character was pressed, you need an IF statement to read the errorlevel variable as follows in this example: -IF %ERRORLEVEL%==[ID] GOTO [Section] Where the variable "ID" is the character index of the character pressed and "Section" is the part of the program you want to jump to afterwards. Part 6.4 - More colors Batch scripts are two color by default, background and foreground. But what if you want to highlight a piece of text on screen, or to draw attention to a specific phrase? What if you want to make some nice graphics? Well, here's your solution right here: The multicolor script. Before we get into it's syntax and uses, you first need to add the following things to your program. This section needs to go at the top of your script: -SETLOCAL EnableDelayedExpansion -for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do ( set "DEL=%%a" ) If you already have delayed expansion enabled prior to this, you do not need to add this line to your program. Similarly, you do not need to add it elsewhere in your program after this. Next, at the end of your program, add this: -goto :eof -:C -echo off - "%~2" -findstr /v /a:%1 /R "^$" "%~2" nul -del "%~2" > nul 2>&1 -goto :eof This is the section that will allow you to add extra color to your program. It's syntax is as follows, with some catches we'll discuss in a second: -CALL :C [BG][TX] "[Text]" Where "BG" is your background color, "TX" is your foreground color, and "Text" is the string you want to print. The color table is exactly the same as that used in the COLOR command. Here are some examples of it's use: -CALL :C 0A "Hello" -CALL :C %BG%E "Yellow" -CALL :C C0 "Wrong" These would result in "Hello" being green on black, "Yellow" being yellow on the background color, and "Wrong" being black on red. Very useful! However, there is a bit of a catch to this: YOU CANNOT USE ANY WINDOWS PROHIBITED CHARACTERS. This is due to the way that this extension works, and while inconvenient, is still a decent trade off for getting some color into your program. Also, you will need to do a line break immediately afterwards, since otherwise it will continue on the same line until the end of the next ECHO statement. This, however, can be useful, since you can get many different colors on the same display line. Also keep in mind that this method is VERY HARD DISK INTENSIVE and could POTENTIALLY DAMAGE SOLID STATE MEDIA. It also will NOT WORK AT ALL with READ ONLY MEDIA. In Windows 2000 and XP, it will also end every string with a ":. . " in the original screen colors. Take this into account when designing programs to use it! The OS version detection described in Section 7.1 - OS version can help a lot with this by detecting the Windows version automatically and potentially solve this problem much more easily for you. Part 6.5 - Variable slicing Variable slicing is extremely important in more complex programs, as you can cut out a section of a string or a specific number from a set - This makes it possible to create arrays and even matrices with only a few variables instead of several dozen. To do this, we first need to enable delayed expansions with the following command: -SETLOCAL EnableDelayedExpansion This allows us to use the batch extensions not usually available to a program via normal means. This should not affect the normal operation of other things in a program, since I have seen nothing happen with it personally, but if you experience any issues it might be a good idea to contact us about adding corrections to this document for future reference. To begin slicing, we need to also understand character indexes, which are numerical IDs referencing any character in a string. In batch, these IDs start at 0 and end with the string, unlike some other programming languages which contain a special end character. For example, in the variable "WORD", there are 4 IDs, 0 through 3. They are organized such that W is 0, O is 1, R is 2, and D is 3. This is true for all variables in batch, including numbers. Next, to select a character out of a variable, we use the following syntax: -SET [Slice]=![Input]:~[ID],[Len]! Where "Slice" is the output text, which is the result of cutting out the part you want, "Input" is the variable you are cutting, "ID" is the character index, and "Len" is how much of the variable you want to cut out after the index. Here are some examples: -SET TEMP=!%WORD%:~0,1! -SET TEMP=!%FOX%:~1,2! -SET TEMP=!%BATCH%:~1,4! This would result in TEMP being "W", "OX", and "ATCH". Part 6.6 - Bell character +Windows 7 or later is required for this!+ The bell character will allow you to make a simple sound to alert users that something has happened, usually as a low health warning or a process complete or some other kind of warning. To get access to this, you need to add the following line to the beginning of your program: -for /f %%. in ('forfiles /m "%~nx0" /c "cmd /c echo 0x07"') do set bell=%%. This sets the variable "BELL" to cause a noise when it is accessed, as follows: -ECHO %BELL% Part 6.7 - File operations File operations are necessary to store any kind of permanent data on a computer through batch. The main points of this are folders and files. The syntax for creating and removing a folder is as follows: -MD [Name] -RD [Name] This will create a folder with the name "Name" in the root directory, and remove that same folder (if it is empty.) To empty a folder, use the following syntax: -DEL [Name] This will also delete any file with the same name, or all the files in a particular directory (folder). To display the contents of a folder, use the following syntax: -DIR [Name] -DIR [Name] /W -DIR [Name] /P -DIR [Name] /W /P This will display the contents of the directory vertically, which can be a pain if there are a lot of files. The /W switch will display them horizontally instead, and /P will pause between entire screens if you have many files. It's always a good idea to keep all the folders and files for a particular program organized in one directory - usually at the root of the main hard disk, C. In the case of Journey, this was: -C:\Journey\ All of the game's files were stored here, which made it difficult to lose these files. It could detect the existence of the folder at startup and create it if necessary. To detect whether or not a folder or file exists, you can use the following syntax: -@IF EXIST [Name] GOTO [Section] -@IF NOT EXIST [Name] GOTO [Section] Where "Name" is the filename and directory, and "Section" is the title of the program section you want to jump to in the case that the file does or does not exist. To create a file, you can simply ECHO the data into it, as follows: -ECHO [Text]>[Name] -ECHO [Text]>>[Name] Where "Text" is the data you want to put into the file at the directory and with the name "Name". Using > will create a new file, or overwrite the a file with the same name, and using >> will simply append the text onto the end of the file instead. You can copy files using the following syntax: -COPY [File] [New] Where "File" is the original and "New" is the destination file and name. This can be used to rename files and move them between formats and locations. If you hadn't noticed, all of these commands are the same as are used in the Windows command interpreter and as well in MS-DOS. Most other commands from these also work. Part 6.8 - Getting arguments Arguments are very useful when used properly between external scripts - They can allow you to pass data between opened scripts easily. To pass arguments to a script, simply use a CALL line as is described in Part 6.2 - Calling external scripts. Separate the parameters with a space. You can have up to 255 different parameters, but for this most basic method (not using SHIFT), we will be limited to just 9. To access these parameters in your script, use the following syntax: -%[ID] Where the variable "ID" is the number of the argument. Using this, here are some examples: -%1 -%4 -%9 In these examples, if we had passed "A B C D E F G H I" into the script, we would get "A D I" back out using these variables. Simple enough, see? Part 6.9 - Terminal size The size of the terminal can be changed with a simple command, with the syntax shown below: -MODE CON:COLS=[Columns] LINES=[Lines] Where the variable "Columns" is the number of columns, or width of the terminal, and "Lines" is the number of lines, or the height of the terminal. However, there are restrictions to this, since the screen is usually only so big, and Windows won't let you get a terminal larger than 120x120, but this still leaves a lot of room to play with in your program. Section 7.0 - System variables Part 7.1 - OS version Getting the OS version, while a chore, can help with compensating for formatting issues between the old Windows NT shell (2000 and XP) and the newer versions (Windows Vista and later). To get the system version, we could always use the "OS" variable, which will tell us if we are running Windows NT or 9x, which can, of course, bypass the trouble of supporting those older versions, but this still leaves potential problems with needing Widnows 7 and later support, while the application might still run under Windows 2000 or XP. This can be avoided by getting the variable "VERSION", which is set to the Windows version number at the beginning of the program. This is done by adding a line to the beginning of your program. There are two different versions because Windows tends to slice them differently, and it's best to just add the extra line to compensate. -for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j -for /f "tokens=5-6 delims=. " %%i in ('ver') do set VERSION=%%i.%%j This will set the variable "VERSION" to a value from the table below: 5.0 - Windows 2000 5.1 - Windows XP 5.2 - Windows Server 2003 6.0 - Windows Vista 6.1 - Windows 7 6.2 - Windows 8 6.3 - Windows 8.1 10.0 - Windows 10 Part 7.2 - System time The system time and date are accessed as %TIME% and %DATE%. These variables are formatted as follows: -HH:MM:SS.SS -DAY MM/DD/YYYY For example: - 8:46:15.27 -Tue 02/27/2018 These variables can be sliced just as any other ordinary value, except that they cannot be modified. Part 7.3 - Other variables There are several other miscellanious variables that can be used in your scripts. They are listed below with a brief description in no particular order: %0 - Execution name. Typically the name of your file %CD% - Current directory. Typicaly on C: %HOMEDRIVE% - Current drive letter. Typically C: %OS% - Windows interpreter version. Typically Windows_NT