in reply to Furmark & Speedfan command line in perl

Howdy wangruonan, welcome to the Monastery!

I take it your question is how to pass command line arguments to the programs you're calling? Quoting the documentation for Win32::Process:

Win32::Process::Create($obj,$appname,$cmdline,$iflags,$cflags,$curdir)

Creates a new process.

Args: $obj container for process object $appname full path name of executable module $cmdline command line args $iflags flag: inherit calling processes handles or not $cflags flags for creation (see exported vars below) $curdir working dir of new process

In other words, just replace "notepad.txt" in your script with strings containing the desired arguments.

Replies are listed 'Best First'.
Re^2: Furmark & Speedfan command line in perl
by Anonymous Monk on Sep 05, 2014 at 09:53 UTC
Re^2: Furmark & Speedfan command line in perl
by wangruonan (Initiate) on Sep 08, 2014 at 09:42 UTC
    Hey thank you AppleFritter. I replaed notepad.txt with my FurMark command line: "/nogui /width=1024 /height=728 /disable_osi /log_gpu_data /log_gpu_data_polling_factor=6". But it's not working..
    #!/usr/bin/perl # process.plx use warnings; use strict; use Win32::Process; use Win32; my $speedfan; my $furmark; my $counter; my $hot; my $cold; print "Please enter cycle count:"; $counter=<STDIN>; print "Please enter hot cycle time:"; $hot=<STDIN>; print "Please enter cold cycle time:"; $cold=<STDIN>; sub ErrorReport{ print Win32::FormatMessage(Win32::GetLastError()); } Win32::Process::Create($speedfan, "C:\\Program Files (x86)\\SpeedFan\\speedfan.exe", "notepad.txt", 0, NORMAL_PRIORITY_CLASS, ".")|| die ErrorReport (); print "SpeedFan has been opened.\n"; while ($counter > 0) { Win32::Process::Create($furmark, "C:\\Program Files (x86)\\Geeks3D\\Benchmarks\\FurMark_1.12.0\\Fur +Mark.exe", "/nogui /width=1024 /height=728 /disable_osi /log_gpu_data /log_gp +u_data_polling_factor=60", 0, NORMAL_PRIORITY_CLASS, ".")|| die ErrorReport (); print "Furmark has been opened at $counter"; sleep $hot; print "timesup.\n"; my $exit_code = 1; $furmark->Kill($exit_code); $counter = $counter-1; sleep $cold; }

      You're welcome, partner! *tips hat*

      I just looked into why this isn't working - turns out you must also include the program's name in your command line arguments, so if you prepend "furmark" or "furmark.exe" to the parameters, it should work.

      Same for the SpeedFan invocation (you still have a "notepad.txt" there, BTW).

        Thank you again! It works! :)