@Echo off
title RW Windows Server Installer V1.0 - Installer
color 1b
echo ------------------------------------
echo -  RW Auto Server Installer v1.0   -
echo -           By Yahgiggle           -
echo -  Auto Update, Backup and reboot  -
echo ------------------------------------
timeout /t 5 /NOBREAK
Call Settings.bat

mkdir %Serverdrive%:\%ServerFolder%\steamcmd
mkdir %Serverdrive%:\%ServerFolder%\Server
mkdir %Serverdrive%:\%ServerFolder%\Version
mkdir C:\RWServerSettings
COPY files\Boot.bat "%Serverdrive%:\%ServerFolder%\Server"
COPY files\7z.exe "%Serverdrive%:\%ServerFolder%\Server"
COPY files\7z.dll "%Serverdrive%:\%ServerFolder%\Server"
COPY files\rebooter.cmd "%Serverdrive%:\%ServerFolder%\Server"
COPY files\updater.cmd "%Serverdrive%:\%ServerFolder%\Server"
COPY files\Start.cmd "%Serverdrive%:\%ServerFolder%\Server"
COPY Settings.bat "C:\RWServerSettings"
bitsadmin /transfer wcb /priority high https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip %Serverdrive%:\%ServerFolder%\steamcmd\steamcmd.zip
%Serverdrive%:\%ServerFolder%\Server\7z.exe x %Serverdrive%:\%ServerFolder%\steamcmd\steamcmd.zip -o%Serverdrive%:\%ServerFolder%\steamcmd -aos
%Serverdrive%:\%ServerFolder%\steamcmd\steamcmd.exe +login anonymous +force_install_dir %Serverdrive%:\%ServerFolder%\Server +app_update 339010 validate +quit
COPY Boot.bat "%Serverdrive%:\%ServerFolder%\Server"
start cmd.exe /c Start %Serverdrive%:\%ServerFolder%\Server\Boot.bat
powershell -Command "Start-Process %Serverdrive%:\%ServerFolder%\Server\rebooter.cmd -Verb RunAs"
EXIT
