Search code examples
vbscripthta

How do I get a batch file to open a vbs or hta located in the Program Files (x86) folder?


I am setting up a program that needs to access files located in the Program Files (x86) folder, so I can distribute it to my friends

I run the bat file that I created and it throws up an error saying "Windows cannot find "C:\Program" Make sure you typed the name correctly, and then try again. I have tried removing the spaces, but that didn't work either

start C:\Program Files (x86)\EDITH\EDITH.hta
timeout /t 6 /nobreak
start C:\Program Files (x86)\EDITH\EDITH2.vbs
timeout /t 235 /nobreak
start C:\Program Files (x86)\EDITH\EDITH3.hta
timeout /t 10 /nobreak

I was expecting it to open the specified files, but it threw up the error (Up above)


Solution

  • Where is Double quotes in your code ??

    Try this :

    start "" "C:\Program Files (x86)\EDITH\EDITH.hta"
    timeout /t 6 /nobreak >nul
    start "" "C:\Program Files (x86)\EDITH\EDITH2.vbs"
    timeout /t 235 /nobreak >nul
    start "" "C:\Program Files (x86)\EDITH\EDITH3.hta"
    timeout /t 10 /nobreak >nul