我想知道特定机器上 VBScript 的默认主机是什么,是否设置为 WScript 还是 CScript ?例如,如果我使用cscript //h:cscript //s
那么有什么方法可以检查主机 VBScript 是否设置为 cscript ?
我找到了更改默认主机的命令,但没有找到检查默认主机的命令。
Edit:
C:\Windows\system32>cscript //h:cscript //s
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
保存命令行选项。
默认脚本主机现在设置为cscript.exe
.
C:\Windows\system32>ftype VBSFile
VBSFile="%SystemRoot%\System32\WScript.exe" "%1" %*
在运行脚本之前如何确定计算机上的默认脚本宿主? http://blogs.technet.com/b/heyscriptingguy/archive/2006/03/27/how-can-i-determine-the-default-script-host-on-a-computer-before-i-run-a-script.aspx
Const HKEY_CLASSES_ROOT = &H80000000
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "VBSFile\Shell\Open\Command"
objRegistry.GetExpandedStringValue HKEY_CLASSES_ROOT,strKeyPath,vbNullString,strValue
strValue = LCase(strValue)
Wscript.Echo strValue
If InStr(strValue, "wscript.exe") then
Wscript.Echo "WScript"
Else
Wscript.Echo "CScript"
End If
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)