简体   繁体   中英

Launching separate visual windows in Powershell (start "%%A powershell.exe in CMD)

Currently I have to cmd /ca separate CMD file which I would like to eliminate

I tried

cmd /c "for /f %%A in (foo.txt)do start "%%A" powershell.exe "get-eventlog -logname security -instanceID 4625 -after $timeCut -message "*bar*" -comp %%A | select machinename,timegenerated, eventid, @{n='AccountName';e={$_.ReplacementStrings[5]}}"" 

but I think there are too many " and I did both %A and %%A

I would like to launch a separate window for each server in just PS.

好吧,我弄清楚了,并且能够将其保持在一行

(get-content foo.txt) | foreach-object {start  powershell "-noexit get-eventlog -logname security -instanceID 4625 -after $timeCut -message *bar* -comp $_ | select machinename,timegenerated, eventid, @{n='AccountName';e={$_.ReplacementStrings[5]}}"}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM