in reply to Re^3: exec()ed process dont write to std(?:err|out) (system)
in thread exec()ed process dont write to std(?:err|out)

As for the bigger picture of what you are really trying to do, I won't pretend to understand it.

Oh sorry. The idea is so that when I have a bunch of scripts running I can see which perl is running which script in the process view of the task manager. For instance I may have 5 or 6 different scripts running at various points at the day. When I view the task manager I can only see say three "perl.exe"'s running, with no easy way to know _what_ they are running. So if one of them goes nuts I know which task to kill for example.


---
demerphq

    First they ignore you, then they laugh at you, then they fight you, then you win.
    -- Gandhi


Replies are listed 'Best First'.
Re^5: exec()ed process dont write to std(?:err|out) (system)
by tye (Sage) on Apr 13, 2004 at 16:00 UTC
    start "skimFundsFromTransactions.pl" perl -S skimFundsFromTransactions +.pl CreditCard 0.002% $100,000

    Go to "task manager", select the "Applications" tab, right-click on the application titled "skimFundsFromTransactions.pl", select "Go to process" from the resulting pop-up menu, note that a specific instance of perl.exe is now highlighted in the "Processes" tab.

    Alternately, if you write your little trick or something similar using a *.bat or *.cmd instead of Perl, then you don't need to have the intermediary instance of perl.exe (which will clutter your taskmanager display). You can even steal a trick I've used several times of having a *.bat that is mostly a Perl script but that writes the final command to be run afters its "__END__" and ":endofperl" lines, to get the same effect while not having to know as much about *.bat/*.cmd programming.

    - tye        

      You can even steal a trick I've used several times

      Heh, believe me I thought of it already. And yes I thought of it as "tye's trick", from one of the registry tools you posted. :-) The problem with it was that I couldn't (and still can't) see how I can use a single wrapper with multiple scripts this way. I was worried about multiple scripts modifying the batch file simultaneously. And if I wrap all the scripts in the first place then I might as well just modify pl2bat to do the right thing in the first place.

      But using start with a specific name hadnt occured to me. Good idea. Thanks.


      ---
      demerphq

        First they ignore you, then they laugh at you, then they fight you, then you win.
        -- Gandhi


        I couldn't (and still can't) see how I can use a single wrapper with multiple scripts this way.

        Something like this, maybe?

        @echo off REM REM nperl.bat REM REM Assumes %1 holds perl script copy /Y C:\Perl\bin\perl.exe %1.exe > NUL %1.exe %* del /Y %1.exe > NUL

        Put it in your path, and call it as: nperl script.pl args

        I tried to figure out a way to avoid hard-coding the path to the perl executable, but Windows batch files are pretty limited and I couldn't come up with one.

        Update: This might not work on earlier versions of Windows (ie, pre-2k? non-NT based?), as they don't support the %* construct. (At least, I don't think they do.)

        bbfu
        Black flowers blossom
        Fearless on my breath