开发者

Windows Script Host cannot find the file on startup

I am having here a vbs-file which starts a batch script. The batch should run invisible, so i use this vbs-script:

WScript.CreateObject( "WScript.Shell" ).Run "loop.bat",0,0

The vbs is registered to the run-key in the registry-

Everytime on startup it tells me that he cannot find the specified file. Maybe the Windows Script Host is starting to late for my vbs-script?

What should I do?

vbs with delayed start? This needs another loop, but my script shall be invisible.

vbs in the startupfolder? Better taking the registry. For other reasons I cannot use the startupfolder.

Thank开发者_C百科s for your answers :)


I know it's old... But i thought I'd put this in in case anyone stumbles here.

if you add something to run, when it starts unless otherwise specified it's working directory is C:\Windows\System32 so if you point to a file, "mybat.bat" it will assume it's in c:\windows\system32\mybat.bat

that's why you need to specify the whole path in the vbs.

if you are in a bat file then add this to the top of your file:

PUSHD %~dp0

Martyn

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜