Reg 不启动 vbscript
Reg not starting vbscript
我在 .reg 文件中有注册表项。 reg 文件用于制作 URI Scheme。当我将 %1 参数传递给 .bat 文件时它起作用了,但我不喜欢查看 .bat 文件,所以我想使用众所周知的隐藏 .bat 文件的 VBScript 方法。如何将参数传递给批处理文件?
Apps.reg
REGEDIT4
[HKEY_CLASSES_ROOT\Apps]
@="URL:Apps Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\Apps\shell]
[HKEY_CLASSES_ROOT\Apps\shell\open]
[HKEY_CLASSES_ROOT\Apps\shell\open\command]
@="\"M:\Apps\Apps.vbs\" \"%1\""
Apps.vbs
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "Apps.bat" & Chr(34), 0
Set WshShell = Nothing
批处理文件只使用了 %1 个参数。问题是获取批处理文件的参数。目前,每次我尝试将 URI 方案与 VBScript 一起使用时,我都会得到 "apps://foo is not a valid Win32 application." 任何帮助表示感谢!
这个有效:
WshShell.Run "Apps.bat /foo", 0
如果你想从命令行中分离出可能包含空格的程序路径,你可以试试这个:
WshShell.Run """Apps.bat"" /foo", 0
我在 .reg 文件中有注册表项。 reg 文件用于制作 URI Scheme。当我将 %1 参数传递给 .bat 文件时它起作用了,但我不喜欢查看 .bat 文件,所以我想使用众所周知的隐藏 .bat 文件的 VBScript 方法。如何将参数传递给批处理文件?
Apps.reg
REGEDIT4
[HKEY_CLASSES_ROOT\Apps]
@="URL:Apps Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\Apps\shell]
[HKEY_CLASSES_ROOT\Apps\shell\open]
[HKEY_CLASSES_ROOT\Apps\shell\open\command]
@="\"M:\Apps\Apps.vbs\" \"%1\""
Apps.vbs
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "Apps.bat" & Chr(34), 0
Set WshShell = Nothing
批处理文件只使用了 %1 个参数。问题是获取批处理文件的参数。目前,每次我尝试将 URI 方案与 VBScript 一起使用时,我都会得到 "apps://foo is not a valid Win32 application." 任何帮助表示感谢!
这个有效:
WshShell.Run "Apps.bat /foo", 0
如果你想从命令行中分离出可能包含空格的程序路径,你可以试试这个:
WshShell.Run """Apps.bat"" /foo", 0