CScript.exe的默认设置

时间:2016-07-11 15:07:54

标签: windows vbscript cmd wsh

默认情况下如何使CSript.exe /K运行我的脚本?

还可以设置cmd窗口出现的默认设置吗?(最大化窗口,选择字体,大小等)。

更新:

我在运行/K的背景下听说过这个开关cmd.exe。我想要实现的是在脚本因错误而完成或退出后让我的窗口保持打开状态。

1 个答案:

答案 0 :(得分:0)

下一步设置可能有所帮助:Open3Open4可能符合您的要求......

  • Open (默认:双击打开WScript.exe)
  • Open2使用命令提示符打开
  • Open3 CScript&&保持开放
  • Open4 CScript&&暂停&&靠近

reg查询:

==> for %G in ("" 2 3 4) do @reg query HKCR\VBSFile\Shell\Open%~G /S

HKEY_CLASSES_ROOT\VBSFile\Shell\Open\Command
    (Default)    REG_EXPAND_SZ    "%SystemRoot%\System32\WScript.exe" "%1" %*


HKEY_CLASSES_ROOT\VBSFile\Shell\Open2
    (Default)    REG_EXPAND_SZ    Open &with Command Prompt
    MUIVerb    REG_EXPAND_SZ    @%SystemRoot%\System32\wshext.dll,-4511

HKEY_CLASSES_ROOT\VBSFile\Shell\Open2\Command
    (Default)    REG_EXPAND_SZ    "%SystemRoot%\System32\CScript.exe" "%1" %*


HKEY_CLASSES_ROOT\VBSFile\Shell\Open3
    (Default)    REG_SZ    CScript && stay open

HKEY_CLASSES_ROOT\VBSFile\Shell\Open3\Command
    (Default)    REG_SZ    "C:\Windows\System32\cmd.exe" /S /K " "C:\Windows\System32\CScript.exe" "%1" "


HKEY_CLASSES_ROOT\VBSFile\Shell\Open4
    (Default)    REG_SZ    CScript && pause && close

HKEY_CLASSES_ROOT\VBSFile\Shell\Open4\Command
    (Default)    REG_SZ    "C:\Windows\System32\cmd.exe" /S /C " "C:\Windows\System32\CScript.exe" "%1" & pause"

regedit档案:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\VBSFile\Shell]
@="Open"

[HKEY_CLASSES_ROOT\VBSFile\Shell\Open]

[HKEY_CLASSES_ROOT\VBSFile\Shell\Open\Command]
@=hex(2):22,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,\
  00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,57,00,\
  53,00,63,00,72,00,69,00,70,00,74,00,2e,00,65,00,78,00,65,00,22,00,20,00,22,\
  00,25,00,31,00,22,00,20,00,25,00,2a,00,00,00

[HKEY_CLASSES_ROOT\VBSFile\Shell\Open2]
@=hex(2):4f,00,70,00,65,00,6e,00,20,00,26,00,77,00,69,00,74,00,68,00,20,00,43,\
  00,6f,00,6d,00,6d,00,61,00,6e,00,64,00,20,00,50,00,72,00,6f,00,6d,00,70,00,\
  74,00,00,00
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,77,00,73,00,68,00,65,00,78,00,74,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,\
  34,00,35,00,31,00,31,00,00,00

[HKEY_CLASSES_ROOT\VBSFile\Shell\Open2\Command]
@=hex(2):22,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,\
  00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,43,00,\
  53,00,63,00,72,00,69,00,70,00,74,00,2e,00,65,00,78,00,65,00,22,00,20,00,22,\
  00,25,00,31,00,22,00,20,00,25,00,2a,00,00,00

[HKEY_CLASSES_ROOT\VBSFile\Shell\Open3]
@="CScript && stay open"

[HKEY_CLASSES_ROOT\VBSFile\Shell\Open3\Command]
@="\"C:\\Windows\\System32\\cmd.exe\" /S /K \" \"C:\\Windows\\System32\\CScript.exe\" \"%1\" \""

[HKEY_CLASSES_ROOT\VBSFile\Shell\Open4]
@="CScript && pause && close"

[HKEY_CLASSES_ROOT\VBSFile\Shell\Open4\Command]
@="\"C:\\Windows\\System32\\cmd.exe\" /S /C \" \"C:\\Windows\\System32\\CScript.exe\" \"%1\" & pause\""