Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: WIN32 exec mystery

by ton (Friar)
on Jul 02, 2002 at 20:34 UTC ( [id://178993]=note: print w/replies, xml ) Need Help??


in reply to WIN32 exec mystery

Weirdness.

Here's some code that works, using Win32::Process. (Note: I made a copy of notepad.exe in my "Program Files" directory to test spaces.)

use Win32::Process; my $prgPath = 'c:/program files/notepad.exe'; my $prgArgs = 'notepad.exe'; Win32::Process::Create( $processObj, $prgPath, $prgArgs, 0, NORMAL_PRIORITY_CLASS, ".") || die Win32::FormatMessage(Win32::Get +LastError());
$prgArgs is (obviously) the arguments that get passed into the program. By convention, the first argument is always the executable name. notepad.exe doesn't seem to care if you pass itself in as the first argument or not, but some other programs do...

Hope this helps.

-Ton
-----
Be bloody, bold, and resolute; laugh to scorn
The power of man...

Replies are listed 'Best First'.
All is good
by major tom (Novice) on Jul 02, 2002 at 23:53 UTC
    Ok,
    this will do fine.

    Thanks!

    Also I have found the answer regarding hiding the console window in another posting.

    I love super search, this site and PERL!

    Tom

    Edited: ~Wed Jul 3 16:40:59 2002 (GMT), by footpad:
    Converted HREF hyperlink to id:// link, per Consideration

      Quick followup about hiding console window:

      I found a small utility called ConsoleTool that served me a better soloution than running the script with wperl.exe - because when my script was run this way, the console (dos box) kept comming up every time the script needed to run some dos-batch files.
      Instead I started the script in normal console window (with perl.exe) and from within the script called ConsoleTool. The script goes away (from screen/taskbar) and stays away even when dos-system-commands/batch-files are executed from within my script.

      Nice.

      tom

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-19 16:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found