Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. @echo off
  2.  
  3. rem Batch script (.bat or .cmd) command line arguments variables
  4.  
  5. rem %* - for all command line parameters (excluding the script name itself)
  6. rem %0 - the command used to call the batch file
  7. rem %1 - is the first command line parameter
  8. rem %2 - is the second command line parameter, and so on till %9 (and SHIFT can be used for those after the 9th)
  9. rem %~nx0 - the actual name of the batch file, regardless of calling method (some-batch.bat)
  10. rem %~dp0 - drive and path to the script including trailing backslash (d:\scripts\)
  11. rem %~dpnx0 - is the fully qualified path name of the script (d:\scripts\some-batch.bat)
  12.  
  13. set ZZZ=%~dp0
  14. rem remove trailing backslash
  15. set DIR=%ZZZ:~0,-1%
  16. set FILE=%~nx0
  17.  
  18. echo Script filename: "%FILE%"
  19. echo Script directory: "%DIR%"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement