Skip to content

Instantly share code, notes, and snippets.

@matthiesenj
Last active January 16, 2020 15:00
Show Gist options
  • Save matthiesenj/ebdee052d65815969506497d2a60380d to your computer and use it in GitHub Desktop.
Save matthiesenj/ebdee052d65815969506497d2a60380d to your computer and use it in GitHub Desktop.
Pause if bat/cmd script is run by double-clicking it in Windows Explorer
rem pause if run from windows explorer (match 'cmd.exe /c ""%~0"')
rem note that this is not bulletproof - other tools may use cmd /c <your file> to run your script!
echo %cmdcmdline%|find /i /c "cmd.exe /c """"%~0""" >nul && pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment