如何检查 VBScript 的默认宿主是 WScript 还是 CScript? [英] How to check default host for VBScript is WScript or CScript?

查看:27
本文介绍了如何检查 VBScript 的默认宿主是 WScript 还是 CScript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道特定机器上 VBScript 的默认主机是什么,是设置为 WScript 还是 CScript ?例如,如果我使用 cscript//h:cscript//s 那么有什么方法可以检查 VBScript 的主机是否设置为 cscript?

I would like to know what is default host for VBScript on particular machine, whether that is set to WScript or CScript ? For example, if I use cscript //h:cscript //s then is there any way I can check host for VBScript is set to cscript?

我找到了更改默认主机的命令,但没有找到检查默认主机的命令.

I found commands to change default host but did not find command to check default host.

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" %*

推荐答案

如何在我之前确定计算机上的默认脚本主机运行脚本?

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

这篇关于如何检查 VBScript 的默认宿主是 WScript 还是 CScript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆