http://www.perlmonks.org?node_id=525091


in reply to Win32::Start Perl/Tk Script Without Annoying DOS Window

ActiveState also includes a "program" called PL2BAT that will transform your perl script into a batch file (so you can launch it directly w/o having to type perl ...).

So, use PL2BAT on your program: pl2bat yourTKscript.pl

This creates yourTKscript.bat

Now edit the bat file and change the perl line to start wperl -x -S %0 %*

(This assumes you are using windows >= NT).

This will cause the batch file to launch your TK script using the wperl executable (no DOS window) AND it will NOT wait for it to return (your TK script to exit) before it returns you to the DOS command prompt.

Without the "start" on the front, your batch file would not return to the command line prompt until your TK script exited.

- James

Edit by GrandFather - replaced pre tags with code tags.

Replies are listed 'Best First'.
Re^2: Win32::Start Perl/Tk Script Without Annoying DOS Window
by Anonymous Monk on Sep 22, 2010 at 02:48 UTC
    On Windows Vista: I want to launch myperlscript.pl from the windows desktop with a double click and have it execute without the dos console window. If I create a myperlscript.bat that does: "c:\perl\bin\wperl.exe myperlscript.pl", the batch file itself seems to cause a dos console window to start up. As far as I know I can't change the file association on "myperlscript.pl" to use wperl.exe instead of perl.exe without causing all .pl files to change to wperl. I was also unable to create a shortcut on the desktop as described in a previous message above. Any hints?
      create a shortcut and NOT a batch file
      The easiest method is to create a new file association that executes wperl.exe

      To change which program starts when you double-click a file, follow these steps:

        Click Start, and then click Control Panel
        Click Folder Options
        Click File Types tab in Folder Options window and the full file types and their association will be listed
        Click New and type the File Extension (.wp) in the box and then click Advanced
        Choose an association for the file type (wperl.exe)
        Click OK and then Click Close
        Open the file again

      Here is the original Microsoft KB article