Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Sign-Code.bat (Source)

@echo off
REM File: Sign-Code.bat
REM Purpose: make it possible to drop files onto this
:: Check for admin rights by trying to create a folder in %windir%
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    powershell.exe -Command "Start-Process -FilePath '%~f0' -ArgumentList '%*' -Verb RunAs"
    exit /b
)
:: If we get here, we have admin rights
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "E:\CodeSign\Scripts\Sign-Code.ps1" %*
pause