zoukankan      html  css  js  c++  java
  • Sublime的Terminal插件win10下更改Powershell为CMD

    参考链接:https://segmentfault.com/a/1190000007070029

    描述

    Win10系统默认sublime安装的Terminal插件使用的是powershell,想要更换成黑窗口的cmd

    步骤

    1. 找到Terminal插件安装包路径

    Preferences--> Browser Package--> 找到Terminal文件夹

    1. 找到Terminal.py,搜索关键字os.path.exists(os.environ['SYSTEMROOT'],对下面进行注释,选择使用cmd方式。也就是说将if..else之间的代码进行注释
    if os.name == 'nt':
                # if os.path.exists(os.environ['SYSTEMROOT'] +
                #         '\System32\WindowsPowerShell\v1.0\powershell.exe'):
                #     # This mimics the default powershell colors since calling
                #     # subprocess.POpen() ends up acting like launching powershell
                #     # from cmd.exe. Normally the size and color are inherited
                #     # from cmd.exe, but this creates a custom mapping, and then
                #     # the LaunchPowerShell.bat file adjusts some other settings.
                #     key_string = 'Console\%SystemRoot%_system32_' + 
                #         'WindowsPowerShell_v1.0_powershell.exe'
                #     try:
                #         key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
                #             key_string)
                #     except (WindowsError):
                #         key = _winreg.CreateKey(_winreg.HKEY_CURRENT_USER,
                #             key_string)
                #         _winreg.SetValueEx(key, 'ColorTable05', 0,
                #             _winreg.REG_DWORD, 5645313)
                #         _winreg.SetValueEx(key, 'ColorTable06', 0,
                #             _winreg.REG_DWORD, 15789550)
                #     default = os.path.join(package_dir, 'PS.bat')
                #     sublime_terminal_path = os.path.join(sublime.packages_path(), installed_dir)
                #     # This should turn the path into an 8.3-style path, getting around unicode
                #     # issues and spaces
                #     buf = create_unicode_buffer(512)
                #     if windll.kernel32.GetShortPathNameW(sublime_terminal_path, buf, len(buf)):
                #         sublime_terminal_path = buf.value
                #     os.environ['sublime_terminal_path'] = sublime_terminal_path.replace(' ', '` ')
                # else :
                    default = os.environ['SYSTEMROOT'] + '\System32\cmd.exe'
    

    1. 测试是否验证成功
  • 相关阅读:
    shell 指定范围产生随机数
    shell脚本比较两个数大小
    Shell 脚本实现随机抽取班级学生
    linux通过挂载系统光盘搭建本地yum仓库的方法
    kuberenetes 上使用helm部署rancher如何卸载干净
    Windows 下 左Ctrl和Caps交换
    C#笔记 -- 协变、逆变
    Python 读取window下UTF-8-BOM 文件
    生成命令行程序使用脚本
    ffmpeg 命令小记
  • 原文地址:https://www.cnblogs.com/it774274680/p/14807212.html
Copyright © 2011-2022 走看看