Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DOS command in PERL script 2

Status
Not open for further replies.

mstelmac

Technical User
Oct 22, 2003
53
US
Hello everyone, I am trying to kick off a DOS command from within my PERL script. I'm sure this is easy for you guys but it is killing me. I'm extremely new to PERL and more experienced with UNIX than dos. Can anyone suggest a solution, I think back slashes or ticks are in the worng place.

Thanks in advance !!!!
-Matt

system("start cqperl C:\\Program Files\\Rational\\ClearQuest\\Scripts\\cq_query.pl read_only read_only OECR OSCAR -j "Public Queries/Admin Dahlgren Weekly Download" -o C:\\Program Files\\Rational\\ClearQuest\\Scripts\\OSCAR\\db_output.txt");
 
Does that command run from the command line in DOS?


Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Yes it runs fine from the command line.
 
it looks like the unescaped embedded double quotes are getting you Matt, try this:

system("start cqperl C:\\Program Files\\Rational\\ClearQuest\\Scripts\\cq_query.pl read_only read_only OECR OSCAR -j \"Public Queries/Admin Dahlgren Weekly Download\" -o C:\\Program Files\\Rational\\ClearQuest\\Scripts\\OSCAR\\db_output.txt");

Mike

I am not inscrutable. [orientalbow]

Want great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Mike thanks for the help...... I tried what you suggested:

system("start cqperl C:\\Program Files\\Rational\\ClearQuest\\Scripts\\cq_query.pl read_only read_only OECR OSCAR -j

\"Public Queries/Admin Dahlgren Weekly Download\" -o C:\\Program

Files\\Rational\\ClearQuest\\Scripts\\OSCAR\\db_output.txt");

What is happening now is that it is ignoring the -j flag. Any thoughts?

v/r,
Matt
 
Build up the string into a variable, and pass the variable to the system call

Code:
$var="start cqperl C:/Program Files/Rational/ClearQuest/Scripts/cq_query.pl read_only read_only OECR OSCAR -j \"Public Queries[COLOR=red]\[/color]/Admin Dahlgren Weekly Download\" -o C:/Program Files/Rational/ClearQuest/Scripts/OSCAR/db_output.txt";
print $var;
system($var);
The red / is an addition which could have been causing an issue

HTH
--Paul

Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Paul,
Thank you very much for your assistance. We just got it working by slashing out all of the bad characters. Here is a working version:

system("start cqperl \"C:\\Program Files\\Rational\\ClearQuest\\Scripts\\cq_query.pl\" read_only read_only OECR OSCAR -j \"Public Queries\/Admin Dahlgren Weekly Download\" -o \"C:\\Program Files\\Rational\\ClearQuest\\Scripts\\OSCAR\\db_output.txt\"");

Thanks Paul !!!!!!!
-matt

 
cool *s*

Mike

I am not inscrutable. [orientalbow]

Want great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top