in reply to system command

Get the command-line for a Word document using Win32::FetchCommand, supplying the file name. Then you can feed that into system or Win32::Process::Create.

Replies are listed 'Best First'.
Re^2: system command
by BrowserUk (Patriarch) on Mar 31, 2010 at 09:58 UTC

    Does that work if the OPs text file doesn't have an extension that is associated with word?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Good point, I had made that assumption. The command can be grabbed programatically using
      my @Cmd = FetchCommand('.doc');
      assuming that file association is setup for Microsoft Word and the .doc file extension.
Re^2: system command
by wwe (Friar) on May 27, 2010 at 12:49 UTC
    Hi, my comment arrives a bit late for the discussion but I found this thread while looking for help about Win32::Process and want to help somebody else who read this later :-).

    If you want to start a process with Win32::Process you need to pass full-qualified executable name, which is usually unknown. In this case Win32::SearchPath is helpful. Find out the path to the executable:

    my $cmd = Win32::SearchPath::SearchPath('ipconfig');
    The module checks either the path in the same way as Windows does or let you specify directories where to look:
    my $cmd = Win32::SearchPath::SearchPath('ipconfig', 'C:\Windows');

    Then you start the process as you want using Win32::Process:

    Win32::Process::Create( $ProcessObj, $cmd, '/all', 0, IDLE_PRIORITY_CL +ASS, "." ) || die "error running process";