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

Published on Jul 11, 2021

Reading time: 1 min

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

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

Edit this page on Github

Share this Article

Comments

utteranc.es uses Github Issues, no data is stored.
You can disable it from your authorized apps.