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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

please advice tried and tried lot times 1

Status
Not open for further replies.

mohankrishna919

Programmer
Jan 18, 2012
14
US
my $cod="c:\\Program\\ Files";


system("start $cod");

when i am doing this it throws error
the error indicates its not accepting space between program and files
but my path is c:\program files, there is space between program and files
tried lot of ways
finally popsting here
please help
 
This works:

Perl:
[COLOR=#006600]#!/usr/bin/perl -w[/color]
[COLOR=#0000FF]use[/color] strict;

[COLOR=#0000FF]my[/color] $cod=[COLOR=#808080]"C:\\Program Files"[/color];
[COLOR=#FF0000]system[/color]([COLOR=#808080]"start \"Title\" \"$cod\""[/color]);

Note that when you quote the first parameter of the start command it assumes you are supplying a window title, which is why I had to include one (even though you don't actually see it).

Annihilannic
[small]tgmlify - code syntax highlighting for your tek-tips posts[/small]
 
my $TSMBACKUPSTATEMENT="C:\\ProgramFiles\\Tivoli\\TSM\\TDPSql\\tdpsqlc\" backup $database FULL /sqlbuff=2 /strip=2 /SQLSERV=$servername";
system("start \"Title\" \"$TSMBACKUPSTATEMENT\"");

the above statement is executing fine but when i include one more line to store the output its not working :

my $TSMBACKUPSTATEMENT="C:\\Program Files\\Tivoli\\TSM\\TDPSql\\tdpsqlc\" backup $database FULL /sqlbuff=2 /strip=2 /SQLSERV=$servername >> C:\\dba\\test.out 2>&1" ;
system("start \"Title\" \"$TSMBACKUPSTATEMENT\"");
 
when i google it i found it can be accomplished using backtiks but i did not find anything on how to use it
please suggest for my code
 
You have a \" after your tdpslc command, but none before it, and then another set around the whole commadn in your system() statement. You need to do it in one place or the other, in this case it needs to be in the $TSMBACKUPSTATEMENT because the path is followed by other parameters. This should work I think.

Code:
my $TSMBACKUPSTATEMENT="\"C:\\Program Files\\Tivoli\\TSM\\TDPSql\\tdpsqlc\" backup $database FULL /sqlbuff=2 /strip=2 /SQLSERV=$servername >> C:\\dba\\test.out 2>&1" ;
system("start \"Title\" $TSMBACKUPSTATEMENT");


Annihilannic
[small]tgmlify - code syntax highlighting for your tek-tips posts[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top