Environment variables
Environment variables are the most common way to deal with variables with pBat. They are usually defined by the operating system but pBat uses its own implementation. Any external binary executed from pBat inherits its environment.
Use
Environment variables can be defined, deleted or modified using the SET command.
Environment variables can be included in command using Variable expansion.
Default defined variables
Some environment variables are automatically defined by pBat.
Eight of them are native variables :
-
%PBAT_OS% : OS type.
-
%PBAT_PATH% : pBat binary path.
-
%PBAT_VERSION% : pBat version.
-
%ERRORLEVEL% : Return value of last executed program.
-
%CD% : Current directory.
-
%RANDOM% : A random number.
-
%DATE% : Date.
-
%TIME% : Time.
Some other variables are defined by the operating system or by pBat_Auto.bat:
-
%PATH% : pBat paths list variable.
-
%SYSTEMDRIVE% : Disk root.
-
%SYSTEMROOT% : Operating system folder path.
-
%USERPROFILE% : Current user folder path.
Note
Variables names are case insensitive (eg. %ErrorLevel% is equivalent to %errorlevel%).
See also
Special variables , Variable expansion, Specifications index.