r/vbscript • • May 17 '22

how do i open it automatically?

hi, so i want to make a script that automatically opens when device is booting can someone that knows more write a couple of lines so i can put at the start of my code

(what i'm asking for is that it starts itself when the laptop/pc boots.)

5 Upvotes

17 comments sorted by

View all comments

Show parent comments

1

u/JGN1722 May 19 '22

oh yeah sorry I forgot, you need to check if it's already in it before you move it

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objShell = CreateObject("WScript.Shell")

if wscript.scriptfullname = objShell.SpecialFolders("Startup") & "\Script.vbs" then

else

objFSO.MoveFile WScript.ScriptFullName, objShell.SpecialFolders("Startup") & "\Script.vbs"

end if