1 2 3
my $programm = 'C:\Test Ordner\start.exe'; my $pfad = 'C:\Test Ordner\'; exec('"'.$programm.' '.$pfad.'"');
1 2 3
my $programm = 'C:\Test Ordner\start.exe'; my $pfad = 'C:\Test Ordner\'; exec('"'.$programm.'" "'.$pfad.'"');
1 2 3 4 5 6 7
my $program = '/bin/foo'; my @arguments = ( '--option', 'argument with spaces', ); exec( $programm, @arguments ) or die "exec failed: $!\n";
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#### INSPECTOR OF ARGUMENTS
$ cat inspect_args.sh
#! /bin/bash
echo "expect $# lines:"
echo "----------------"
I=1
for ARG in "$@"; do
echo "$I: >$ARG<"
I=$[I+1]
done
$
### CALLER OF INSPECTOR WITH ARGUMENTS
$ cat perl_exec.pl
#! /usr/bin/perl
use strict;
use warnings;
# https://www.perl-community.de/bat/poard/thread/18171
my $program = './inspect_args.sh';
my @arguments = (
'foo',
'bar',
'hello world',
);
exec(
$program,
@arguments,
) or die "exec failed: $!\n";
__END__
$
### LET THEM DO THEIR JOBS
$ perl perl_exec.pl
expect 3 lines:
----------------
1: >foo<
2: >bar<
3: >hello world<
$
1 2 3 4 5 6 7
my $appfolder; my $tempfolder; ($appfolder) = $0 =~ m/(.+[\\\/]).+\..+$/i; $tempfolder = $appfolder."tmp\\"; print $appfolder."\n"; print $tempfolder."\n"; exec($tempfolder."update.exe",$appfolder);
1 2 3 4 5 6 7 8 9 10 11 12 13
C:\Users\Tester\Desktop\programm - Name1 - Version>programm.pl C:\Users\Tester\Desktop\programm - Name1 - Version\ C:\Users\Tester\Desktop\programm - Name1 - Version\tmp\ C:\Users\Tester\Desktop\programm - Name1 - Version>- Name1 - Version\tmp\update.exe C:\Users\Tester\Desktop\programm - Name1 - Version\