运行 带有 ActiveX 的命令只尝试创建一个名为 my command 的文件

Running a command with ActiveX only tries to create a file named my command

我 运行 这个 vbscript 在 html 页面上

Dim WinScriptHost
Set WinScriptHost = CreateObject("WScript.shell")
WinScriptHost.Run Chr(34) & reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v name_of_key /d C:\path\to\exe /f" & Chr(34), 0

它不起作用。我查看 Procmon 并看到它 运行 对路径 C:\root\directory\of\html\file\reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v name_of_key /d C:\path\to\exe /

create file 命令

为什么它会尝试创建一个文件?为什么不直接 运行ning 呢?

(我认为真正的命令应该有一个 cmd /C 前缀,但同样的问题发生了。它尝试创建一个文件,只是带有 cmd /C 前缀)

我通过移除 Char(24)

让它工作

新代码是:

WinScriptHost
Set WinScriptHost = CreateObject("WScript.shell")
WinScriptHost.Run "reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v name_of_key /d C:\path\to\exe /f", 0