Search code examples
windowsvbscriptstartup

Windows vbs script


I'm trying to make a vbs script to set an application to run on windows startup, but it seems not to work... here's the code:

set WshShell = CreateObject("Wscript.Shell")
set fs = CreateObject("Scripting.FilesystemObject")
pathe = WshShell.SpecialFolders("Startup")
start()
function start()
x = fs.CopyFile("hello.bat", Path & "\", True)
end function
wscript.echo(Path)

if you know any other method to set a file to run on startup it is good


Solution

  • Try this, just a one liner can do this:

    CreateObject("Shell.Application").NameSpace(7).CopyHere "hello.bat", 4 + 16 + 1024 : Wscript.Echo "hello.bat"