help with VBS script start a .exe

maurice cristen
maurice cristen used Ask the Experts™
on
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

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Bill PrewTest your restores, not your backups...
Top Expert 2016

Commented:
Try:

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


»bp
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

Author

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

Test your restores, not your backups...
Top Expert 2016
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

Author

Commented:
ok

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial