MonsterAar
Programmer
Code so far:
#!/usr/bin/perl -w beeps.
#loader.pl
#Luke Aaron
#Start: 29/01/08
#Build: A 29/01/08
#Script to act as a script loader to be located in C:\Documents and Settings\USER in order to easily launch scripts from the command line
#located in C:\Documents and Settings\USER\My Documents\My Programs without having to first use CD
#Yes, it's lazy.
print "\nScript: ";
$input = <STDIN>;
chomp($input);
$input =~ tr/A-Z/a-z/;
#check for quit
if($input eq 'exit') {
exit();
};
#create full path
#be sure to change USER in path if need be
@parts = ("C:\\Documents and Settings\\Luke Aaron\\My Documents\\My Programs\\", $input, '.pl');
$path = join('', @parts);
#create command
@cmdp = ('perl', $path);
$cmd = join(' ', @cmdp);
#run command
system($cmd);
The problem is, the output I get is:
Can't open perl script "C:\Documents" etc. It seems that it stops looking at the first space. I tried replacing all spaces with %20 but that didn't help: the whole path showed but it didn't interpret the %20s as spaces.
Any help?
Thanks,
Luke
#!/usr/bin/perl -w beeps.
#loader.pl
#Luke Aaron
#Start: 29/01/08
#Build: A 29/01/08
#Script to act as a script loader to be located in C:\Documents and Settings\USER in order to easily launch scripts from the command line
#located in C:\Documents and Settings\USER\My Documents\My Programs without having to first use CD
#Yes, it's lazy.
print "\nScript: ";
$input = <STDIN>;
chomp($input);
$input =~ tr/A-Z/a-z/;
#check for quit
if($input eq 'exit') {
exit();
};
#create full path
#be sure to change USER in path if need be
@parts = ("C:\\Documents and Settings\\Luke Aaron\\My Documents\\My Programs\\", $input, '.pl');
$path = join('', @parts);
#create command
@cmdp = ('perl', $path);
$cmd = join(' ', @cmdp);
#run command
system($cmd);
The problem is, the output I get is:
Can't open perl script "C:\Documents" etc. It seems that it stops looking at the first space. I tried replacing all spaces with %20 but that didn't help: the whole path showed but it didn't interpret the %20s as spaces.
Any help?
Thanks,
Luke