This question is different to the one it's being marked as a duplicate of because that is about how to detect how the batch file was started from within the batch file. This question is about how to get the batch file to pause when double-clicked, but not pause when started from a console. I agree, there's some overlap. The answers to that question are one potential way of achieving what's being asked for. But, there are other ways and the accepted answer does not attempt to determine from within the batch file how it was started.
I've written a batch file to automate some tasks. I can run it from a command window and it runs and displays results. If I double click it from explorer though, it runs and terminates immediately so I can't see the results.
Is there a way I can make batch file window stay open until I dismiss it if I started it by double-clicking the icon?
I don't want to have to pass a /nopause parameter or something when I call a batch file from the command line. I'd like a solution where I can use the batch file without having to do anything too special?
Thanks.
NOTE I don't want it to pause when running from the command line!! I may call this batch file from another batch file to carry out a load of operations. In that case I can't be sitting there to keep hitting enter.