Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- rem Batch script (.bat or .cmd) command line arguments variables
- rem %* - for all command line parameters (excluding the script name itself)
- rem %0 - the command used to call the batch file
- rem %1 - is the first command line parameter
- rem %2 - is the second command line parameter, and so on till %9 (and SHIFT can be used for those after the 9th)
- rem %~nx0 - the actual name of the batch file, regardless of calling method (some-batch.bat)
- rem %~dp0 - drive and path to the script including trailing backslash (d:\scripts\)
- rem %~dpnx0 - is the fully qualified path name of the script (d:\scripts\some-batch.bat)
- set ZZZ=%~dp0
- rem remove trailing backslash
- set DIR=%ZZZ:~0,-1%
- set FILE=%~nx0
- echo Script filename: "%FILE%"
- echo Script directory: "%DIR%"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement