Skip to content

Instantly share code, notes, and snippets.

@hyriph
Created January 26, 2026 11:39
Show Gist options
  • Select an option

  • Save hyriph/7cd7c5304b659a44b48d49ba74aa7407 to your computer and use it in GitHub Desktop.

Select an option

Save hyriph/7cd7c5304b659a44b48d49ba74aa7407 to your computer and use it in GitHub Desktop.
@echo off
setlocal
cd /d "%~dp0"
net session >nul 2>&1
if %errorlevel% neq 0 (
powershell -NoProfile -ExecutionPolicy Bypass ^
-Command "Start-Process -FilePath '%~f0' -Verb RunAs"
exit /b
)
REM .venv의 python으로 실행 + cmd 창 유지 (불필요한 출력 없음)
start "MyApp (Admin)" cmd /k ""%~dp0.venv\Scripts\python.exe" "%~dp0main.py""
endlocal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment