I have tried making the script open with windows terminal (wt.exe) but it displays the error :
[error 0x800700c1 when launching `"C:\Users\hjdom\OneDrive\Desktop\All desktop stuff\Python Game\RunGame.ps1"']
I really need it to run in the windows terminal because it allows you to keep typing commands after the script is over. I am using the script to run a python file.
this is what the ps1 script contains:
python ./pythonfiles/startgame.py
Thanks so much! -BlueFalconHD
The Windows Terminal (wt.exe) is not a command shell.
It is a host for command shells (powershell, bash, cmd, python, perl, etc.). You have to tell WT.exe which to use, to call your script.
Example - cmd.exe or via the WinKey Run:
Type:
wt d:\temp\hello.ps1
this will fail with...
[error 0x800700c1 when launching `d:\temp\hello.ps1']
... even though Windows Terminal launches with whatever default shell is in your WT settings.
Now do this...
wt.exe powershell D:\Scripts\hello.ps1
... this works, because you told wt.exe which shell to use to execute your script.
Update as per your comment.
but then how do I prevent the terminal from closing after the script is done running?
Your target shell needs to provide a method for that. Powershell (Windows and Core) provide this via the -NoExit
switch.
powershell /?
PowerShell[.exe] [-PSConsoleFile <file> | -Version <version>]
[-NoLogo] [-NoExit] [-Sta] [-Mta] [-NoProfile] [-NonInteractive]
[-InputFormat {Text | XML}] [-OutputFormat {Text | XML}]
[-WindowStyle <style>] [-EncodedCommand <Base64EncodedCommand>]
[-ConfigurationName <string>]
[-File <filePath> <args>] [-ExecutionPolicy <ExecutionPolicy>]
[-Command { - | <script-block> [-args <arg-array>]
| <string> [<CommandParameters>] } ]
wt.exe powershell -NoProfile -NoLogo -NoExit D:\Scripts\hello.ps1
wt.exe pwsh -NoProfile -NoLogo -NoExit D:\Scripts\hello.ps1
If you are calling another shell, bash, python, perl, etc., then they too would need to provide that.
User contributions licensed under CC BY-SA 3.0