Can't run Vbscript from batch file

January 22, 2016 at 21:36:34
Specs: Windows 10
When I click on this Vbscript "InitiateStartScreen.vbs"
it changes desktop to Start Screen.

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "^{ESCAPE}"

But I can't get a batch file to execute it.

Any help appreciated.

I should add I want the batch file to terminate and the Start Screen to display, which running the vbscript does.

message edited by FrankV

See More: Cant run Vbscript from batch file

Report •

January 23, 2016 at 01:08:01
start InitiateStartScreen.vbs

Keep in mind that the batch file must be in the same directory as the vbs file. Otherwise you must include either the full path, or if it's in a sub-directory you must specify the path from where the batch file is, like this:

start "C:\Folder\Folder2\script.vbs"

start "SubDir1\Subdir2\script.vbs"

Don't worry if plan A fails, there are 25 more letters in the alphabet ;)

Report •

January 23, 2016 at 07:38:12
RainBawZ, thank you for plan A. I have tried the start cmd but without success. A window just flashes and nothing else, so it is not working for me. The vbs file and bat file is in the same windows 10 path: C:\999_Scripts\InititateStartScreen.vbs I have tried with and without this path.

If you place my two lines of vbs above in a batch file and run the batch file does your tile start screen open? If so, that would be interesting to know.

I guess on to Plan B.

Report •

January 24, 2016 at 20:57:56
What does your batchfile have? Mine has:
@echo off
cscript /nologo xx.vbs
it seemed to work in limited testing, Obv. cscript needs to be in deflt path or qualified so batch can find it.
xx.vbs has same content as your Initiatestartscreen.vbs.
It might be a 64-bit or a win-10 problem. I ran on win-7 32-bit for my test.

Report •

Related Solutions

January 24, 2016 at 21:21:03
nbrane, thanks. i'm still getting a quick flash of the dos screen and nothing else.

I only have your command lines in a batch file. Just want the batch file to initiate the start screen. Seems like such a simple thing. Yes I have 64-bit and Win10.

Both the batch vbs files are in C:\999_Scripts path.

I tried cscript /nologo "C:\999_Scripts\InitiateStartScreen.vbs"
and same result; or no result.

On to Plan C.

Report •

January 24, 2016 at 21:44:57
My first suspicion is your platform. Can you get access/run it on 32-bit? (I admit to a strong distrust of anything 64-bit, not to mention anything above win-XP). I can't test 64-bit unless I find one in my other junk. Another thing to look out for is security, as MS gets more anal with each version and tries to squash independent programming - but usually you get an error message.

Report •

January 24, 2016 at 22:25:17
I can click on the vbs file and the start screen appears. My guess is it has something to do with the command lines in the vbs file that is preventing the batch file from executing the script file. Just a hunch; have no idea why.

I have a few computers but they are all 64bit/win10 so don't have a way to check 32bit.

I also put the vbs file in local group policy editor user startup and the start screen appears after log in is complete. No issue there. Just haven't been able to find a way to get a batch file to execute this vbs file.

What happens is this computer is dedicated to a gaming software. I have custom tiles that execute different aspects of a gaming software. Each tile has a batch file that opens the particular aspect of the software. When I exit the software the batch file completes a few steps and ends at the desktop. I simply want the last line of the batch file to return to the start screen by executing the vbs file above.

For testing I have no commands in a batch file other than those suggested to execute the vbs file.

Report •

Ask Question