Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Small Problem with running Perl Scripts in Windows

by BrowserUk (Patriarch)
on Jun 16, 2003 at 20:45 UTC ( [id://266293]=note: print w/replies, xml ) Need Help??


in reply to Small Problem with running Perl Scripts in Windows

Another solution to the problem is to tweak the command associated with your perl scripts. By default this looks (something like) this

perl_script=e:\perl\bin\perl.exe "%1" %*

If you modify this to

ftype perl_script=%comspec% /k e:\perl\bin\perl.exe "%1" %*

Then the cmd window will remain once the script terminates.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller


Replies are listed 'Best First'.
Re: Re: Small Problem with running Perl Scripts in Windows
by bkenik (Initiate) on Sep 23, 2003 at 21:50 UTC
    I am using WxPerl scripts which run in their own GUI windows. However, when I click on a WxPerl script, the DOS window opens up and remains open until the script terminates. Is there a way to create ftype association (I use .plx extension) to have the DOS window run in "minimized" mode. I using Windows 98 and I am not sure if &comspec% is defined. Thank you for any help you could provided.

      I have a funny feeling I saw a post somwhere that gave instructions for doing this (for Tk gui scripts) but I can't find it. Hopefully, someone else will notice this post and know.

      First, I've never used WxPerl, or Win98 so whether this will work for you I have no idea. This is what I have set up for Tk scripts which prevents any console window being displayed at all under AS 5.8 and NT4.

      P:\test>assoc .plb .plb=perl_background_script P:\test>ftype perl_background_script perl_background_script=wperl.exe "%1"

      In order for this to work, wperl.exe has to have a flag set in the executable to indicate that it is to run in the WINDOWS subsystem rather than as a console app. I cannot remember if it is set up this way out of the box, or whether I had to modify it to be so. The easy way to check is to use the exetype.bat program that you'll find in your perl\bin directory. If this reports the WINDOWS subsystem as below, the above associations should allow you to double-click .plb scripts in the explorer and have them run without any console window showing up.

      P:\test>exetype \bin\wperl.exe \bin\wperl.exe uses the WINDOWS subsystem.

      However, if it reports wperl.exe to be a CONSOLE app,

      P:\test>exetype \bin\perl5.8.0.exe \bin\perl5.8.0.exe uses the CONSOLE subsystem.

      then you need to modify it by adding the WINDOWS parameter on the same command

      P:\test>exetype \bin\wperl.exe WINDOWS

      I suspect that this is the diference between wperl.exe and perl.exe and you don't need to do this, but I included the info in case my memory is wrong, and I had to do this myself previously.


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
      If I understand your problem, I can solve it! Of course, the same can be said for you.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://266293]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-20 04:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found