2

I'm trying out the Windows Terminal app and I want to start using it instead of CMD. The problem is, I cannot set the File Explorer to open Python files with it by default. I tried using the Open button leading to the file path, but I get the following error

wt
The file cannot be accessed by the system.

pu239
  • 707
  • 7
  • 17
  • Try adding to the Registry an equivalent of the following: `reg query "HKCR\Python.File\Shell\Open in Windows Terminal\command"` should return something like `wt.exe new-tab --title "cmd" cmd.exe /k "C:\WINDOWS\py.exe" "%L" %*` for its _default_ value. Maybe `HKCU\SOFTWARE\Classes\Python.File\Shell\Open in Windows Terminal\command` could suffice if you are not a local administrator… – JosefZ Aug 13 '21 at 22:02

4 Answers4

0

With Windows 10, there is no way to change the default terminal from Windows Console Host to Windows Terminal.

However, with Windows 11, it is now possible to change the default terminal application. This currently needs a Windows Terminal Preview version.

You can activate this from either in Windows 11 Settings (Choose the default terminal app to host the user interface for command-line applications) or in Windows Terminal Preview (Settings->Startup->Default Terminal Application)

NotTheDr01ds
  • 15,620
  • 5
  • 44
  • 70
0

You can have this behaviour on double click by changing

HKEY_CLASSES_ROOT\Python.File\Shell\open\command

default value from:

"C:\Windows\py.exe" "%L" %*

to

"C:\Users\USER\AppData\Local\Microsoft\WindowsApps\wt.exe" "python" "%L" %*

(you have to replace "USER" with the username on your windows machine)

mcgregger
  • 16
  • 1
  • This works perfectly. Thanks. Just so everyone knows, I opened the Registry Editor (Win+R and enter "regedit"), changed the location to `"Computer\HKEY_CLASSES_ROOT\Python.File\Shell\open\command"`, and changed the default value to the value above. It worked as a charm. – Charles Moxey Jr Apr 20 '22 at 15:32
0

You can specify default terminal application in Windows Terminal settings (Startup/Default terminal application):

Default terminal application

Set your default terminal application | Microsoft Learn

ᄂ ᄀ
  • 5,669
  • 6
  • 43
  • 57
0

From regedit-> HKEY_CLASSES_ROOT\Python.File\Shell\open\command
Change: "C:\Windows\py.exe" "%L" %*
to: "Your_Anaconda_Path\python.exe" "%1"
or: "Your_Python_Path\python.exe" "%1"

MasterOne Piece
  • 413
  • 5
  • 5