Timeline for Running executables in Powershell with complex arguments
Current License: CC BY-SA 3.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 7, 2017 at 15:53 | history | edited | Ari Winokur | CC BY-SA 3.0 |
added 406 characters in body
|
| Oct 25, 2017 at 19:52 | answer | added | Rain | timeline score: 0 | |
| Oct 25, 2017 at 15:02 | comment | added | Ansgar Wiechers |
@AriWinokur I don't know what you have tested, but PowerShell can usually run external commands just fine. Use the call operator if your command is a string rather than a bare word: & "gawk.exe" -f "PrepareReport.awk" "input.csv" >> "output.csv".
|
|
| Oct 25, 2017 at 14:50 | comment | added | Bryce McDonald | @JeffZeitlin is correct - you'll either need to add it to your environments path, "dot source" the file, or use the "Start-Process" cmdlet. Check out this link here: stackoverflow.com/questions/25187048/… | |
| Oct 25, 2017 at 14:42 | comment | added | Ari Winokur | I'll give it a try and report back. | |
| Oct 25, 2017 at 14:40 | comment | added | Jeff Zeitlin |
That's exactly what I'm suggesting; you can write out regular commands in PowerShell scripts. If the executable for gawk is in your $env:PATH, it should work just fine as you've given it above. If it's not, you should use the full path\to\gawk. We're running a PowerShell script here that has to invoke the SysInternals PSEXEC on remote computers; PSEXEC runs locally, and the command is simply the same as it would be with CMD.EXE.
|
|
| Oct 25, 2017 at 14:36 | comment | added | Ari Winokur | @JeffZeitlin are you suggesting just writing the command out? Last I checked you can't write out a regular command in a Powershell script. | |
| Oct 25, 2017 at 14:35 | comment | added | Jeff Zeitlin | What's wrong with just invoking it exactly like you would have with the batch file? | |
| Oct 25, 2017 at 14:26 | history | asked | Ari Winokur | CC BY-SA 3.0 |