Absolute path refers to the path to call the absolute program location, for example:
Relative path refers to the file. After changing the path, it will be called according to the path location of the variable, for example:
If the system is installed on disk D and the absolute path is used, the calling program may not be found in the system deployment and installation. At this time, the relative path is needed to call, and the variable parameters are used
Their values are actively assigned by the system according to the pre-defined conditions, that is, these variable systems have defined values for them. We don't need to assign values to them, we just need to call them! I'll list them all!
echo %ALLUSERSPROFILE% ::return"All users"Address of the configuration file. Example: C:\Documents and Settings\All Users(win7 Start to become C:\ProgramData)
echo %APPDATA% ::Local returns the status of data stored by the program by default. Example: C:\Documents and Settings\Administrator\Application Data(win7 Start to become C:\Users\%username%\AppData\Roaming)
echo %CD% ::Returns the current directory string locally. Example: E:\hall\ebook\Small script
echo %CMDCMDLINE% ::Local return is used to start the current Cmd.exe The correct command line. Example: cmd /c ""E:\hall\ebook\Small script\2.bat" "
be careful: This one works ls env: No output
echo %CMDEXTVERSION% ::The system returns the current"Expand command handler"Version number of the. Example: 2
be careful: This one works ls env: No output
echo %COMPUTERNAME% ::The system returns the name of the computer. Example: HP05281125
echo %COMSPEC% ::The system returns the correct path of the executable program of the command line interpreter. Example: C:\WINDOWS\system32\cmd.exe
echo %DATE% ::The system returns the current date. Use and date /t A pattern of similar orders. from Cmd.exe Generate. of date For more information about the command, see Date. Example: 2011-01-12 Wednesday
echo %ERRORLEVEL% ::The system returns the error code of the previous command. A non-zero value is usually used to represent the fault. Example: 9009
echo %HOMEDRIVE% ::The system returns the drive letter of the local workstation connected to the user's home directory. Set based on home directory value. User home directory is in"Local users and groups"Specified in. Example: C:
echo %HOMEPATH% ::The system returns the full path of the user's home directory. Set based on home directory value. User home directory is in"Local users and groups"Specified in. Example:\Documents and Settings\Administrator
echo %LOGONSERVER% ::Returns the name of the domain controller that validates the current login session locally. Example: \\HP05281125
echo %NUMBER_OF_PROCESSORS% ::The system specifies the number of processors installed on the computer. Example: 4
echo %OS% ::The system returns the name of the operating system. Windows 2000 Display its operating system as Windows_NT. Example: Windows_NT
echo %PATH% ::The system specifies the search path for executable files. Example: C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
echo %PATHEXT% ::The system returns a list of executable files whose names the operating system has expanded. Example:.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
echo %PROCESSOR_ARCHITECTURE% ::The system returns the chip system configuration of the processor. Example: x86
echo %PROCESSOR_LEVEL% ::The system returns the model of the processor installed on the computer. Example: 6
echo %PROCESSOR_REVISION% ::The system returns the version number of the processor. Example: 170 a
echo %PROMPT% ::Returns the command reminder setting of the current descriptor locally. from Cmd.exe born. Example: $P$G
echo %RANDOM% ::The system returns any decimal number between 0 and 32767. from Cmd.exe Generate. Example: 30848
echo %SYSTEMDRIVE% ::System returns include Windows server operating system The drive of the root directory (that is, the root directory of the system). Example: C:
echo %SYSTEMROOT% ::System return Windows server operating system The location of the root directory. C:\WINDOWS. Example: C:\WINDOWS
echo %TEMP% ::The system and the user return the default temporary directory applied to the application available to the currently logged in user. Some applications require TEMP，Other applications require TMP. Example: C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp
echo %TIME% ::The system returns the current time. Application and time /t A pattern of similar orders. from Cmd.exe born. of time For more information about the command, see Time. Example: 19:55:12.75
echo %USERDOMAIN% ::Returns the name of the domain that includes the user account locally. Example: HP05281125
echo %USERNAME% ::Returns the name of the currently logged in user locally. Example: Administrator
echo %USERPROFILE% ::Returns the location of the current user's profile locally. Example: C:\Documents and Settings\Administrator(win7 Start, path in C:\Users\lower)
echo %WINDIR% ::The system returns the status of the operating system directory. Example: C:\WINDOWS
With so many system variables, how do we know what their values are?
Enter echo% windir%, windir variable name in CMD. It's not random! In this way, the value of a variable can be displayed!
For example, if we want to copy files to the startup directory of the current account, we can do this
copy d:\1.bat "%appdata%\Microsoft\Windows\Start Menu\Programs\Startup"
%USERNAME% returns the name of the currently logged in user locally.