title: 命令行使用VSCode命令
    date: 2019-09-09 10:00:00
    categories:

    • 工具
      tags:
    • VSCode

    Visual Studio Code安装的时候可选注册命令行工具code.exe到系统中,熟悉一下,日常使用中能提高不少效率。
    添加到系统变量之后,命令行中直接使用code --help,可查看帮助信息。

    1. Visual Studio Code 1.38.0
    2. Usage: code.exe [options][paths...]
    3. To read output from another program, append '-' (e.g. 'echo Hello World | code.exe -')
    4. Options
    5. -d --diff <file> <file> Compare two files with each other. // 文件比较
    6. -a --add <folder> Add folder(s) to the last active window. // 将文件夹在当前窗口打开
    7. -g --goto <file:line[:character]> Open a file at the path on the specified line and character position. // 在指定行和字符位置的路径上打开文件。
    8. -n --new-window Force to open a new window. // 强制打开新窗口
    9. -r --reuse-window Force to open a file or folder in an already opened window. // 强制在已打开的窗口中打开文件或文件夹。
    10. -w --wait Wait for the files to be closed before returning. // 请等待文件关闭后再返回。
    11. --locale <locale> The locale to use (e.g. en-US or zh-TW). // 要使用的区域设置(例如en-US或zh-TW)。
    12. --user-data-dir <dir> Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code. // 指定保存用户数据的目录。可用于打开多个不同的代码实例
    13. -v --version Print version. // 打印版本。
    14. -h --help Print usage. // 帮助
    15. --telemetry Shows all telemetry events which VS code collects. // 显示VS代码收集的所有遥测事件。
    16. --folder-uri <uri> Opens a window with given folder uri(s) // 打开带有给定文件夹uri的窗口
    17. --file-uri <uri> Opens a window with given file uri(s) // 打开带有给定文件uri的窗口
    18. Extensions Management
    19. --extensions-dir <dir> Set the root path for extensions. // 设置插件放置根路径
    20. --list-extensions List the installed extensions. // 列出所有已安装插件
    21. --show-versions Show versions of installed extensions, when using --list-extension. // 使用- list-extension时,显示已安装扩展的版本。
    22. --category Filters installed extensions by provided category, when using --list-extension. // 使用- list-extension时,按提供的类别筛选已安装的扩展。
    23. --install-extension <extension-id | path-to-vsix> Installs or updates the extension. Use `--force` argument to avoid prompts. // 安装或更新扩展,
    24. --uninstall-extension <extension-id> Uninstalls an extension. // 卸载一个更新
    25. --enable-proposed-api <extension-id> Enables proposed API features for extensions. Can receive one or more extension IDs to enable individually. // 为扩展启用建议的应用编程接口功能。可以接收一个或多个扩展标识以单独启用。
    26. Troubleshooting
    27. --verbose Print verbose output (implies --wait). // 打印详细输出。
    28. --log <level> Log level to use. Default is 'info'. Allowed values are 'critical', 'error', 'warn', 'info', 'debug', 'trace', 'off'. // 要使用的日志级别。默认值为“信息”。允许的值为“严重”、“错误”、“警告”、“信息”、“调试”、“跟踪”、“关闭”。
    29. -s --status Print process usage and diagnostics information. // 打印进程使用和诊断信息
    30. --prof-startup Run CPU profiler during startup // 启动时运行CPU探查器
    31. --disable-extensions Disable all installed extensions. // 禁用所有已安装的插件。
    32. --disable-extension <extension-id> Disable an extension. // 禁用一个插件
    33. --inspect-extensions <port> Allow debugging and profiling of extensions. Check the developer tools for the connection URI. // 允许调试和分析扩展。检查开发人员工具的连接URI。
    34. --inspect-brk-extensions <port> Allow debugging and profiling of extensions with the extension host being paused after start. Check the developer tools for the connection URI. // 允许调试和分析扩展,扩展主机在启动后暂停。检查开发人员工具的连接URI。
    35. --disable-gpu Disable GPU hardware acceleration. // 禁用图形处理器硬件加速。
    36. --max-memory Max memory size for a window (in Mbytes). // 窗口的最大内存大小(兆字节)。