greatshots has asked for the wisdom of the Perl Monks concerning the following question:

respected monks,

My main idea of asking this question is in windows perspective. but this may be applicable to all OS which supports GUI environment. For example Linux GUI and unix's GUI session too.
How to launch notepad from perl program. Generally,we will do the following in launching notepad from windows:-
1) Click StartMenu -> Run -> notepad -> Ok
The above will launch the notepad.exe, sameway I can launch winword.. etc .. etc How can I do this from a perl program

Replies are listed 'Best First'.
Re: Launching GUI applications
by Corion (Patriarch) on Sep 25, 2006 at 08:32 UTC

    The same way you would do it from a command line ("DOS Window"):

    system("start notepad.exe"); print "Launched notepad.exe\n";

    See HELP START for more documentation on the START command. This will not wait for the program to finish. If you want to wait for the program, just use

    system("notepad.exe");

    as usual.

Re: Launching GUI applications
by lukeyboy1 (Beadle) on Sep 25, 2006 at 08:37 UTC
    There are two ways of doing this:

    1. By using a system call to the executable "C:/Program Files/My Program/program.exe", and using either a system() or back-ticks to execute it, or
    2. Using the Win32::OLE module to launch your application.

    To be honest, though, maybe you should have looked through the Tutorials or even just searched the site?

    Hope this helps....
      TMTTWTDO (There's More Than Two Ways To Do It). The Win32 API CreateProcess is the underlying mechanism, which is exposed by (amoung others) Win32::Process, which is in the ActiveState base. See also Win32::FetchCommand (CPAN).
Re: Launching GUI applications
by marto (Cardinal) on Sep 25, 2006 at 08:40 UTC
Re: Launching GUI applications
by greatshots (Pilgrim) on Sep 25, 2006 at 08:52 UTC

    thanks a lot. cheers.....