Thread Backticks mit Inputmöglichkeit gesucht (6 answers)
Opened by ContraFack at 2010-01-11 19:33

Gast ContraFack
 2010-01-13 15:48
#130477 #130477
eben, habe es geschafft. danke für denn tipp!

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/perl

use Expect;

$text = "TestShutdown";
$user = "test_admin";
$pw = "admin12345";

#--- CONFIGURATION -----------------------------------------------------------#
$cmd = 'runas /user:$user "shutdown -s"';
$prompt = "[Pp]assword";

#--- START RUNAS LOGIN SEQUENCE ;;! ----------------------------------------------#
$exp = new Expect();
$exp->raw_pty(1);
$exp->spawn($cmd) or die "spawn failed";

#--- LOGIN AND INTERACT ! ----------------------------------------------------#
$exp->expect(10000, [ $prompt => sub { $_[0]->send("$pw\n"); } ]);
$exp->interact();


cheers, ContraFack

View full thread Backticks mit Inputmöglichkeit gesucht