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
Use the tty command.
tty
Use the -s option and check the return value.