@echo off setlocal enabledelayedexpansion rem Use the current directory where the script is executed pushd %~dp0 rem Collect all .go files in the current directory set GO_FILES= for %%f in (*.go) do ( set GO_FILES=!GO_FILES! %%f ) rem Run the Go program with all the .go files go run !GO_FILES! rem Return to the original directory popd