我想用vbs运行本身目录里的一个*.exe文件

2024-11-24 21:50:03
推荐回答(3个)
回答1:

set wshell = Wscript.CreateObject("Wscript.Shell")
set fso = CreateObject("Scripting.FileSystemObject")
set fn=fso.GetFolder(fso.GetParentFolderName(Wscript.ScriptFullName))
Wshell.Run "目标.exe"
Wshell.Run "目标1.reg"
Wshell.Run "目标2.reg"
wshell.Nothing

回答2:

dim wsh,reg
set wsh=wscript.createobject("wscript.shell")
shell.run ".\test.exe" '运行当前目录下的test.exe程序。.\表示当前路径,去掉也行shell.run "test.exe"

set Reg=wscript.createobject("wscript.shell")
Reg.read "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\vbsrun"'读注册表
Reg.RegWrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\vbsrun",WScript.Scriptfullname'把自己添加到注册表启动项

不明白你所谓的打注册表不显示是什么意思,你是想读写注册表不被知道吧,那简单,直接读写就行啦

回答3:

path="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\"
set ws=wscript.createobject("wscript.shell")
t=ws.regwrite(path & "jj","hello")
set shell=createobject("wscript.shell")
shell.run "test.exe"