I have a powershell script that I'm trying to run from a shortcut on macOS (as in the Shortcuts app/widget, not the Dock). I have the mac version of powershell installed and the script runs fine if I call it directly from the terminal. I can't seem to call powershell scripts at all from a shortcut, but I found that I can create a .sh script that calls the .ps1 script, using the full path to the powershell library, I can get the script to run.
The problem is that the script has output text that I need to be able to see. This method displays the initial text that is output as the script starts, but additional text that is output as the script is running never gets displayed.
Another solution would be to have the shortcut open the terminal window with the required text commands, but I can't figure out how to do that either.
I have a powershell script that I'm trying to run from a shortcut on macOS (as in the Shortcuts app/widget, not the Dock). I have the mac version of powershell installed and the script runs fine if I call it directly from the terminal. I can't seem to call powershell scripts at all from a shortcut, but I found that I can create a .sh script that calls the .ps1 script, using the full path to the powershell library, I can get the script to run.
The problem is that the script has output text that I need to be able to see. This method displays the initial text that is output as the script starts, but additional text that is output as the script is running never gets displayed.
Another solution would be to have the shortcut open the terminal window with the required text commands, but I can't figure out how to do that either.
Share edited Feb 10 at 17:55 mklement0 440k68 gold badges702 silver badges918 bronze badges asked Feb 10 at 17:46 HypersapienHypersapien 6232 gold badges9 silver badges24 bronze badges 1- Read following : learn.microsoft/en-us/powershell/scripting/developer/cmdlet/… – jdweng Commented Feb 10 at 18:45
1 Answer
Reset to default 0Figured out the answer. I just needed to run a bash script in the shortcut with this code
osascript -e 'tell app "Terminal"
do script "cd /foldername\n./filename.ps1"
end tell'
And I can string as many commands together as I want with newlines