Powershellの SendKey を介してカスタム アプリケーションにパラメータを渡す方法はありますか
TCL の EXPECT のようなもの
#!/usr/bin/perl -w
use Expect;
my $exp = new Expect;
my $command = 'ssh -l user 10.10.10.25';
$exp->spawn($command) or die "Cannot spawn $command: $!\n";
my $patidx = $exp->expect(30, 'Enter passphrase for key');
$exp->send("password\n");
以下を使用するのにうんざりしましたが、カスタムアプリケーションを呼び出せないようです
$a = Get-Process | Where-Object {$_.Name -eq "Notepad"}
wait
[Microsoft.VisualBasic.Interaction]::AppActivate($a.ID)
[void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
wait
[System.Windows.Forms.SendKeys]::SendWait("{F5}{ENTER}")
私の顧客アプリケーションはC:\somecli -option1 -option2 -option 3のようになります
ping -t 10.10.10.1 という cli コマンドがあります。コマンドは「ping」で、パラメーターは「-t 10.10.10.1」です。そのため、最初にコマンドを呼び出すときは、「ping -t 10.10.10.1」を使用しています。私は別のパラメータを渡す必要があります: いくつかの実行が行われた後、このコマンドに y と言うと、sendkey は私を許可します