如何通过命令行或程序启动Windows Terminal Preview?
如何通过命令行或程序启动Windows Terminal Preview?
别担心,完全不用重装GitHub版本!微软商店版的Windows Terminal Preview确实不能直接双击exe启动(因为商店应用有沙箱权限限制),但我们有和开始菜单启动逻辑一致的方法,下面给你几种实用的方案:
命令行直接启动
在CMD、PowerShell或者运行框(Win+R)里输入这条命令就行,完美绕开权限问题:explorer.exe shell:AppsFolder\Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe!App这其实就是调用系统资源管理器来启动商店版应用,和你点开始菜单的快捷方式是同一个原理。
通过wt.exe指定启动预览版
如果你同时装了普通版和预览版Windows Terminal,还可以用wt.exe加参数直接指定启动预览版:wt.exe -p "Windows Terminal Preview"这个方式更灵活,还能顺便配置窗口布局,比如一次性打开两个预览版标签页(一个PowerShell,一个CMD):
wt.exe -p "Windows Terminal Preview" new-tab -p "Windows Terminal Preview" cmd在程序中调用启动
不管你用什么语言开发程序,本质都是调用系统命令。举两个常见例子:- Python中:
import subprocess subprocess.run(['explorer.exe', 'shell:AppsFolder\\Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe!App']) - C#中:
System.Diagnostics.Process.Start("explorer.exe", "shell:AppsFolder\\Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe!App");
当然也可以用
wt.exe的参数方式,效果是一样的。- Python中:
总结一下,商店版的预览版不需要重装,用上面的方法就能轻松从命令行或程序里启动啦!
备注:内容来源于stack exchange,提问作者RcCookie




