我编辑了hkcr\vbsfile\shell
,因此它镜像了hkcr\vbsfile\shell
。对VBScript使用文件类型关联时,参数仍然不起作用。
我想知道这些注册表项是否会使它失败:
:: reg query hkcr /f vbs*
HKEY_CLASSES_ROOT\.vbs
...
HKEY_CLASSES_ROOT\VBS
HKEY_CLASSES_ROOT\VBS Author
HKEY_CLASSES_ROOT\VBScript
HKEY_CLASSES_ROOT\VBScript Author
HKEY_CLASSES_ROOT\VBScript.Encode
HKEY_CLASSES_ROOT\VBScript.RegExp
HKEY_CLASSES_ROOT\VBSFile
HKEY_CLASSES_ROOT\VBSFile.HostEncode
Suchvorgang abgeschlossen: 21 übereinstimmende Zeichenfolge(n) gefunden.
即使以管理员身份启动HKEY_CLASSES_ROOT\VBS
,我也无法重命名HKEY_CLASSES_ROOT\VBScript
或regedit
。>
:: reg query hkcr\vbs /s HKEY_CLASSES_ROOT\vbs\CLSID (Standard) REG_SZ {B54F3741-5B07-11cf-A4B0-00AA004A55E8} HKEY_CLASSES_ROOT\vbs\OLEScript (Standard) REG_NONE :: reg query hkcr\vbscript /s HKEY_CLASSES_ROOT\vbscript (Standard) REG_SZ VB Script Language HKEY_CLASSES_ROOT\vbscript\CLSID (Standard) REG_SZ {B54F3741-5B07-11cf-A4B0-00AA004A55E8} HKEY_CLASSES_ROOT\vbscript\OLEScript (Standard) REG_NONE :: reg query hkcr\clsid\{B54F3741-5B07-11cf-A4B0-00AA004A55E8} /s HKEY_CLASSES_ROOT\clsid\{B54F3741-5B07-11cf-A4B0-00AA004A55E8} (Standard) REG_SZ VB Script Language HKEY_CLASSES_ROOT\clsid\{B54F3741-5B07-11cf-A4B0-00AA004A55E8}\ Implemented Categories HKEY_CLASSES_ROOT\clsid\{B54F3741-5B07-11cf-A4B0-00AA004A55E8}\ Implemented Categories\{F0B7A1A1-9847-11CF-8F20-00805F2CD064} (Standard) REG_NONE HKEY_CLASSES_ROOT\clsid\{B54F3741-5B07-11cf-A4B0-00AA004A55E8}\ Implemented Categories\{F0B7A1A2-9847-11CF-8F20-00805F2CD064} (Standard) REG_NONE HKEY_CLASSES_ROOT\clsid\{B54F3741-5B07-11cf-A4B0-00AA004A55E8}\InprocServer32 (Standard) REG_SZ C:\Windows\SysWOW64\vbscript.dll ThreadingModel REG_SZ Both HKEY_CLASSES_ROOT\clsid\{B54F3741-5B07-11cf-A4B0-00AA004A55E8}\OLEScript (Standard) REG_NONE HKEY_CLASSES_ROOT\clsid\{B54F3741-5B07-11cf-A4B0-00AA004A55E8}\ProgID (Standard) REG_SZ VBScript
原始帖子
[通过文件类型关联而不是通过cscript.exe
或wscript.exe
调用时,脚本不接收通过命令行传递给它们的参数。
:: type args.vbs Option Explicit WScript.Echo WScript.Arguments.Count Dim arg For Each arg In WScript.Arguments WScript.Echo arg Next :: cscript args.vbs eins zwei drei 3 eins zwei drei :: wscript args.vbs eins zwei drei :: : same thing via the MessageBox :: args.vbs eins zwei drei 0 :: : Why is that? :: assoc .vbs .vbs=VBSFile :: ftype VBSFile VBSFile="%SystemRoot%\System32\WScript.exe" "%1" %*
似乎此文件类型关联将所有参数传递给脚本。但是也许不使用?我该如何追踪呢?这是来自注册表的更多信息:
:: reg query hkcr\.vbs HKEY_CLASSES_ROOT\.vbs (Standard) REG_SZ VBSFile HKEY_CLASSES_ROOT\.vbs\PersistentHandler :: reg query hkcr\VBSFile\Shell\Open /s HKEY_CLASSES_ROOT\VBSFile\Shell\Open\Command (Standard) REG_EXPAND_SZ "%SystemRoot%\System32\WScript.exe" "%1" %* :: reg query hkcr\VBSFile\Shell\Open2 /s HKEY_CLASSES_ROOT\VBSFile\Shell\Open2 (Standard) REG_EXPAND_SZ Open &with Command Prompt MUIVerb REG_EXPAND_SZ @%SystemRoot%\System32\wshext.dll,-4511 HKEY_CLASSES_ROOT\VBSFile\Shell\Open2\Command (Standard) REG_EXPAND_SZ "%SystemRoot%\System32\CScript.exe" "%1" %*
这是Windows 7 Pro 64,如果有关系的话(我认为没有关系)。还有一件事,使用JScript引擎和以下脚本,参数在所有三种情况(
cscript.exe
,wscript.exe
,文件类型关联)中都能正常工作:
var argc = WScript.Arguments.Length; WScript.Echo(argc); for (var i = 0; i < argc; i++) WScript.Echo( WScript.Arguments(i) );
设置:
:: assoc .js
.js=JSFile
:: ftype JSFile
JSFile=C:\Windows\System32\WScript.exe "%1" %*
:: reg query hkcr\jsfile\shell\open\command
HKEY_CLASSES_ROOT\jsfile\shell\open\command
(Standard) REG_SZ C:\Windows\System32\WScript.exe "%1" %*
:: reg query hkcr\jsfile\shell\open2\command
HKEY_CLASSES_ROOT\jsfile\shell\open2\command
(Standard) REG_SZ C:\Windows\System32\CScript.exe "%1" %*
更新后,我编辑了hkcr \ vbsfile \ shell,以使其镜像hkcr \ vbsfile \ shell。将文件类型关联用于VBScript时,参数仍然不起作用。我不知道这些注册表项是否会使它失败::...