0

This code work fine

set oShell = CreateObject ("WScript.shell")
eAppData = oshell.ExpandEnvironmentStrings("%appdata%")
wscript.echo Appdata
oshell.run(Appdata & "\Test.bat"),0,False

This .vbs in %AppData%\Microsoft\Windows\Start Menu\Programs\Startup

But when windows start show this message why ?

enter image description here

The Test.bat is in %appdata%\Test.bat

checkmate
  • 47
  • 6
  • By default the .vbs file will be executed with the help of wscript.exe file.in such case if you use `wscript.echo` you will be getting messagebox.if you want to print the output in console then you need to run your file using cscript.exe – Sudharsan Selvaraj Jul 22 '16 at 00:16
  • So this was the problem all along? You didn't want the pop up to appear? Next time be more descriptive with your question. – user692942 Jul 22 '16 at 05:35

2 Answers2

1

You're using wscript.echo Appdata, which will cause this box to pop open containing the shown folder path.

VortixDev
  • 965
  • 1
  • 10
  • 23
1

And when you get rid of this line : wscript.echo Appdata

This code will come like that if you don't want to display this message again

set oShell = CreateObject ("WScript.shell")
AppData = oshell.ExpandEnvironmentStrings("%appdata%")
oshell.run(Appdata & "\Test.bat"),0,False
Hackoo
  • 18,337
  • 3
  • 40
  • 70