a guest Jun 18th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  3. rem Batch script (.bat or .cmd) command line arguments variables
  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)
  13. set ZZZ=%~dp0
  14. rem remove trailing backslash
  15. set DIR=%ZZZ:~0,-1%
  16. set FILE=%~nx0
  18. echo Script filename:  "%FILE%"
  19. echo Script directory: "%DIR%"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand