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?
By definition, a shell script is always going to be run in a "command prompt". But try using the SESSIONNAME env var - it seems to NOT be present if the script was started by double-clicking instead of manually running it from a prompt.