The last line in my batch file is pause. Is there any way to add a if condition to see if the script is run within command prompt or by double clicking to execute?
pause
I know this is a year later but for future people searching you can use
If /I "%COMSPEC%" == %CMDCMDLINE% Goto SkipPause pause :SkipPause
It will skip the pause block if running from the command line and pause if running from batch file.