windows 在此处打开命令行

2022-12-15 15:08:03 浏览数 (1)

代码语言:javascript复制
方法一:直接启动cmd

Windows Registry Editor Version 5.00 
[HKEY_CLASSES_ROOTDirectoryshellOpenCmdHere] 
@="在此处打开命令提示符"
"Icon"="cmd.exe" 
[HKEY_CLASSES_ROOTDirectoryshellOpenCmdHerecommand] 
@="cmd.exe /s /k pushd "%V"" 
[HKEY_CLASSES_ROOTDirectoryBackgroundshellOpenCmdHere] 
@="在此处打开命令窗口"
"Icon"="cmd.exe" 
[HKEY_CLASSES_ROOTDirectoryBackgroundshellOpenCmdHerecommand] 
@="cmd.exe /s /k pushd "%V"" 
[HKEY_CLASSES_ROOTDriveshellOpenCmdHere] 
@="在此处打开命令窗口"
"Icon"="cmd.exe" 
[HKEY_CLASSES_ROOTDriveshellOpenCmdHerecommand] 
@="cmd.exe /s /k pushd "%V"" 
[HKEY_CLASSES_ROOTLibraryFolderbackgroundshellOpenCmdHere] 
@="在此处打开命令窗口"
"Icon"="cmd.exe" 
[HKEY_CLASSES_ROOTLibraryFolderbackgroundshellOpenCmdHerecommand] 
@="cmd.exe /s /k pushd "%V""


方法二:通过powershell间接启动cmd

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOTDirectoryshellOpenCmdHere]
@="在此处打开命令提示符"
"Icon"="cmd.exe"
[HKEY_CLASSES_ROOTDirectoryshellOpenCmdHerecommand]
@="PowerShell -windowstyle hidden -Command "Start-Process cmd.exe -ArgumentList '/s,/k, pushd,%V' -Verb RunAs""
[HKEY_CLASSES_ROOTDirectoryBackgroundshellOpenCmdHere]
@="在此处打开命令窗口"
"Icon"="cmd.exe"
[HKEY_CLASSES_ROOTDirectoryBackgroundshellOpenCmdHerecommand]
@="PowerShell -windowstyle hidden -Command "Start-Process cmd.exe -ArgumentList '/s,/k, pushd,%V' -Verb RunAs""
[HKEY_CLASSES_ROOTDriveshellOpenCmdHere]
@="在此处打开命令窗口"
"Icon"="cmd.exe"
[HKEY_CLASSES_ROOTDriveshellOpenCmdHerecommand]
@="PowerShell -windowstyle hidden -Command "Start-Process cmd.exe -ArgumentList '/s,/k, pushd,%V' -Verb RunAs""
[HKEY_CLASSES_ROOTLibraryFolderbackgroundshellOpenCmdHere]
@="在此处打开命令窗口"
"Icon"="cmd.exe"
[HKEY_CLASSES_ROOTLibraryFolderbackgroundshellOpenCmdHerecommand]
@="PowerShell -windowstyle hidden -Command "Start-Process cmd.exe -ArgumentList '/s,/k, pushd,%V' -Verb RunAs""

本文采用 「CC BY-NC-SA 4.0」创作共享协议,转载请标注以下信息:

原文出处:Yiiven https://cloud.tencent.com/developer/article/2193247

0 人点赞