help with VBS script start a .exe

this is the script:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run C:\Users\root\Music\folder\mytool.exe
WScript.Sleep 1000
WshShell.SendKeys "{LEFT}"
WshShell.SendKeys "{LEFT}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{SPACE}"

Open in new window


I want this:
I want to run as administrator and then i do this?
i open mytool.exe and ..left arrow twice then i press TAB then i press space to start automatically my exe
but doesn't work i receive this error, can someone help me please?

script: C:Users\root\Desktop\start1.vbs
Line: 2
Char: 16
Error: Expected statement
Code: 800A0400
Source: Microsoft VBScript compilation error

Open in new window

maurice cristenAsked:
Who is Participating?
 
Bill PrewConnect With a Mentor Commented:
Should be:

Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run("""C:\Users\root\Music\folder\soft.exe""")
WScript.Sleep 6000
objShell.SendKeys "{LEFT}"
objShell.SendKeys "{LEFT}"
objShell.SendKeys "{TAB}"
objShell.SendKeys "^{ }"

Open in new window


»bp
0
 
Bill PrewCommented:
Try:

WshShell.Run "C:\Users\root\Music\folder\mytool.exe"


»bp
0
 
Jessica KCommented:
Hey Maurice,

As such, I haven't seen an issue like this but, while searching for your query I have got an informative article regarding the same.
Follow the steps, give in the blog to resolve this problem.

https://www.techwalla.com/articles/how-to-run-exe-in-vbscript
0
 
maurice cristenAuthor Commented:
i finally can open mytool.exe here the script but problem with Line 4 ''tab''
here the script
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run("""C:\Users\root\Music\folder\soft.exe""")
WScript.Sleep 6000
WshShell.SendKeys "{LEFT}"
WshShell.SendKeys "{LEFT}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "^{ }"

Open in new window


here the error:
script: C:Users\root\Desktop\start1.vbs
Line: 4
Char: 16
Error: Object required:"WshShell"
Code: 800A01AB
Source: Microsoft VBScript runtime error

Open in new window

0
 
maurice cristenAuthor Commented:
ok
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.