in reply to Re^2: Problem with System() command in perl?
in thread Problem with System() command in perl?

It'd be helpful if you didn't ignore things. It doesn't matter if you call the .exe directly or not. You seem to have a lot of "wired reasons" for doing things and making life difficult for yourself.

use strict; use warnings; use Win32; use Win32::GuiTest qw(:ALL); my $calc = "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\ +\Accessories\\Calculator.lnk"; print "nothing else will happen until you close calc.exe\n"; system($calc); print "you closed calc.exe, moving on...\n"; print "using `start` to launch calc.exe will return once calc.exe is l +oaded\n"; system('start "" "' . $calc . '"'); print "\n\nyep, still running!\n\n";

Replies are listed 'Best First'.
Re^4: Problem with System() command in perl?
by ankit.tayal560 (Beadle) on Oct 07, 2016 at 11:36 UTC

    it is working thanks but I dint understand the system call.

    system('start "" "' . $calc . '"');

    could you please help me out with that?

      ankit.tayal560 - type start /? in a windows command prompt for more information on what marto is trying to impart.

      basically there are 3 ways to start new processes in perl:

      • open - open (IN, "program.exe|") or die "couldn't start program.exe"
      • system - system('program.exe')
      • backticks or qx - qx(program.exe) or `program.exe`

      careful what you do when running programs that require external input from users, but in a nutshell what's happinging in system('start "" "' . $calc . '"'); is the same as system('program.exe arg1');

      Cheers,
      Shadowsong