If I run a Perl script from a command prompt (c:\windows\system32\cmd.exe), how can I exit the command prompt after the script finishes executing.
I tried system("exit 0") inside the Perl script but that doesn’t exit the cmd prompt shell from where the Perl script is running.
I also tried exit; command in the Perl script, but that doesn’t work either.
If you’re starting the command shell just to run the perl script, the answer by Arkaitz Jimenez should work (I voted for it.)
If not, you can create a batch file like
runmyscript.bat, with content:The
exitwill end the shell session (and as a side effect, end the batch script itself.)