Avatar of maurice cristen
maurice cristen

asked on 

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

VB Script

Avatar of undefined
Last Comment
maurice cristen
Avatar of Bill Prew
Bill Prew

Try:

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


»bp
Avatar of Jessica K
Jessica K

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
Avatar of maurice cristen

ASKER

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

ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of maurice cristen
maurice cristen

ASKER

ok
VB Script
VB Script

VBScript (Visual Basic Scripting Edition) is an interpreted scripting language developed by Microsoft that is modeled on Visual Basic, but with some important differences. VBScript is commonly used for automating administrative and other tasks in Windows operating systems (by means of the Windows Script Host) and for server-side scripting in ASP web applications. It is also used for client-side scripting in Internet Explorer, specifically in intranet web applications.

39K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo