http://qs1969.pair.com?node_id=178993


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