voidrayco / loom

Command line application to manage threads
0 stars 0 forks source link

Calling Powershell scripts #2

Open pN3mesis opened 10 years ago

pN3mesis commented 10 years ago

So while making changes today I've been calling a test batch script... just realized my change to put the "target" as the first parameter in the arguments broke the ability to call a powershell script...

normally i can call any batch script or command in the environment path. C:> loom.exe --script query.bat query.bat target1

But using powershell i need to call powershell.exe first, and then it wants to append the target before the script which breaks it:

PS > .\loom.exe --script powershell.exe -- .\query.ps1 powershell.exe target1 .\query.ps1

Unhandled Exception: System.ComponentModel.Win32Exception: The specified executable is not a valid application for this OS platform.


I'll come back to this tomorrow... gotta find out how to make it general for both batch and powershell, and powershell wants positional parameters like "target" to be early in the args (all arguments before a positional argument must be mandatory for it to work).

tarwich commented 10 years ago

We could always make --powershell an argument that changes the invocation of the sub-command (script). Loom could even run PowerShell for you if you wanted, so --script wouldn't be PowerShell.exe, but rather whatever you wanted to run inside PowerShell.

Whatever is easiest to implement and maintain.

pN3mesis commented 10 years ago

i really cant decide which would be better actually...

I think having a --script and a --powershell (or --psscript) option would be slightly easier

tarwich commented 10 years ago

I think it's best to not allow for --script and --pscript to be a possible source of confusion.

Remember that we can have 52 short options: A..Z and a..z. And p is not taken, so you could have -p --script, where -p is just a flag to tell it to launch PowerShell.

pN3mesis commented 10 years ago

makes sense