Skip to content

Instantly share code, notes, and snippets.

@xpol
Created July 26, 2012 04:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xpol/3180332 to your computer and use it in GitHub Desktop.
Save xpol/3180332 to your computer and use it in GitHub Desktop.
Detect if bat file is running via double click or from cmd window
if %cmdcmdline% == "%SystemRoot%\system32\cmd.exe" (
echo from cmd window...
) else (
pause
)
if "%cmdcmdline:~4,2%"=="/c" (pause)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment