-
Notifications
You must be signed in to change notification settings - Fork 30
Description
Is your feature request related to a problem? Please describe.
There is no quick way to define a run a powershell command from ShellAnything.
The main benefit would be to be easily be able to simplify commands that needs to go through cmd.exe. For example,
<actions>
<exec path="${env.ComSpec}" basedir="${env.TEMP}" arguments="/k ""${ffmpeg.install_directory}\bin\ffprobe.exe" -v verbose -hide_banner -show_streams -show_format -print_format json -i "${selection.path}""" />
</actions>(notice the whole command is escaped twice and wrapped in double-quotes).
As a restriction, this action should always "open a new process" to run the command. Running the powershell command within ShellAnything's process (explorer.exe) would force .NET runtime to load in explorer.exe which is not recommanded.
Describe the solution you'd like
A quick way to define an action that runs a powershell command:
<actions>
<powershell command="Write-Host (10+27)"/>
</actions>Describe alternatives you've considered
N/A
Additional context
There are security concerns about sending the command up to powershell without manipulation.
One way would be to run the following:
- Plan on launching powershell.exe directly, or by running a shell command that starts with "powershell".
- When lauching the process, define the environment variable
SA_POWERSHELL_COMMANDset as action's command property.
For example:Write-Host (10+27). - Launch powershell with the following:
powershell -Command "Invoke-Expression $env:PS_COMMAND". - The command above would print
37on the console and then exit.