Files
Onejsky4U/Content/script/print.ps1
T
2021-10-19 23:28:51 +05:00

23 lines
471 B
PowerShell

Add-Type @"
using System;
using System.Runtime.InteropServices;
public class Util {
[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();
}
"@
$wshell = New-Object -ComObject wscript.shell;
foreach($i in $args){
$app = Start-Process -FilePath $i -passThru -Verb Print
start-sleep -m 200
$wshell.AppActivate($app.Id)
#start-sleep -m 200
$wshell.SendKeys('{ENTER}')
#Wait-Process -InputObject $app
#start-sleep -m 200
}
sleep 10
exit