PilotinControl has asked for the wisdom of the Perl Monks concerning the following question:

Hello Again Monks!
Can you direct me to where I can close an open command prompt on Windows 10 after my perl script has run? the simple exit; or exit(); does not close the open window. Thanks in advance!

Replies are listed 'Best First'.
Re: Close Win32-Console CMD.exe
by LanX (Saint) on Dec 24, 2020 at 04:58 UTC
    Start with wperl.exe and there will be no cmd window at all.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Re: Close Win32-Console CMD.exe
by Marshall (Canon) on Dec 24, 2020 at 06:52 UTC
    There is no need to open or close a command window to run a Perl program on Win 10.

    Please show your code.

    Oh, I see..
    You open an O/S window shell by say using 'cmd' and then type in a command that runs a Perl script.
    The Perl program can exit(), you come back to the window that you started in the first place.
    Perl can not cause its parent to exit.

    #if your Win 10 Perl is configured correctly, #save the following lines as "test.pl". print STDERR "asdasdf\n"; sleep (3); print STDERR "Goodbye\n"; sleep (2);
    Double-click on test.pl in the GUI and you will see the result.
Re: Close Win32-Console CMD.exe
by ikegami (Patriarch) on Dec 24, 2020 at 08:00 UTC

    A console opened by perl will automatically close itself. But if you're launching perl from an interactive console, you can have it close automatically after perl is done using

    perl ... & exit
Re: Close Win32-Console CMD.exe
by Anonymous Monk on Dec 24, 2020 at 13:16 UTC

      @Anonymous Monk
      thanks for that refresher I had totally forgot about asking that before.