Last active
January 16, 2020 15:00
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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