DEV Community

Gabriel Lazcano
Gabriel Lazcano

Posted on

How to run a .exe without opening a prompt in Windows

Link to original article (recommended): https://gabriellazcano.com/blog/how-to-run-a-exe-without-opening-a-prompt-in-windows/

Introduction

I was doing a Golang Shortcuts application and I wanted to run my program in the background without having a prompt in my taskbar all the time.

After investigating I found out this can be achieved by calling the .exe from a .vbs file is a pretty easy way of accomplishing this. You just have to create an object shell and run the .exe with these parameters.

VBS File

Set Shell = CreateObject("WScript.Shell")
Shell.Run "C:\users\dirofyourexecutable.exe", 0, False
Enter fullscreen mode Exit fullscreen mode

Shell.Run receives the path of your executable, an integer indicating the appearance of the programs window, and a boolean indicating whether the script should wait for the program to finish executing.

You can check all the available settings for intWindowStyles

Run on start

If you wanted to run this file when Windows Starts you just have to paste it in the Startup folder located in "C:\Users[username]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" or just type startup in the explorer bar

Top comments (0)