Skip to content

Instantly share code, notes, and snippets.

@dneumann42
Last active April 4, 2026 20:21
Show Gist options
  • Select an option

  • Save dneumann42/10ea35272da875b0f0fe21b726c7f419 to your computer and use it in GitHub Desktop.

Select an option

Save dneumann42/10ea35272da875b0f0fe21b726c7f419 to your computer and use it in GitHub Desktop.
Windows dev setup for sloth-engine
@echo off
setlocal EnableExtensions
set "SCRIPT_NAME=%~nx0"
set "WINGET_ARGS=--source winget --accept-package-agreements --accept-source-agreements"
set "VSCODE_CLI="
call :require_command winget || exit /b 1
echo Installing GitHub Desktop...
call :install_package GitHub.GitHubDesktop || exit /b 1
echo Installing Visual Studio Code...
call :install_package Microsoft.VisualStudioCode || exit /b 1
echo Installing .NET 9 SDK...
call :install_package Microsoft.DotNet.SDK.9 || exit /b 1
call :resolve_code_cli || exit /b 1
echo Installing VS Code C# extensions...
call :install_extension ms-dotnettools.csharp || exit /b 1
call :install_extension ms-dotnettools.csdevkit || exit /b 1
echo.
echo Setup completed successfully.
echo Installed:
echo - GitHub Desktop
echo - Visual Studio Code
echo - .NET 9 SDK
echo - VS Code extensions: ms-dotnettools.csharp, ms-dotnettools.csdevkit
echo.
echo If a new terminal does not recognize dotnet or code yet, open a new Command Prompt window.
exit /b 0
:require_command
where %~1 >nul 2>&1
if errorlevel 1 (
echo Error: required command '%~1' was not found in PATH.
echo Install Windows Package Manager ^(winget^) and re-run %SCRIPT_NAME%.
exit /b 1
)
exit /b 0
:install_package
winget install -e --id %~1 %WINGET_ARGS%
if errorlevel 1 (
echo Error: failed to install package %~1.
exit /b 1
)
exit /b 0
:resolve_code_cli
where code >nul 2>&1
if not errorlevel 1 (
set "VSCODE_CLI=code"
exit /b 0
)
if exist "%LocalAppData%\Programs\Microsoft VS Code\bin\code.cmd" (
set "VSCODE_CLI=%LocalAppData%\Programs\Microsoft VS Code\bin\code.cmd"
exit /b 0
)
echo Error: Visual Studio Code installed, but its CLI was not found.
echo Expected 'code' in PATH or '%LocalAppData%\Programs\Microsoft VS Code\bin\code.cmd'.
exit /b 1
:install_extension
if /I "%VSCODE_CLI%"=="code" (
code --install-extension %~1 --force
) else (
call "%VSCODE_CLI%" --install-extension %~1 --force
)
if errorlevel 1 (
echo Error: failed to install VS Code extension %~1.
exit /b 1
)
exit /b 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment