in reply to Problem with System() command in perl?

Many modules ship with examples, take a look at calc.pl, note how these examples start applications. system

  • Comment on Re: Problem with System() command in perl?

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

    yes I already looked into that. he's opening calculator through its main .exe file that is why it is working. but for some weird reason I have to open it from the shortcut that is why I used that path in system call. how can we do the same operation when invoking calculator through shortcut??? any suggestions???

      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";

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

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

        could you please help me out with that?