Is there anyone who can help me with a *.bat file? When I move this file to another folder and open it crashes

echo off
color 02
if not exist “%homepath%\Desktop\SM backup scripts\Create backup SM(Survival).bat” (set /p move=Want to move scripts to your desktop [Y/N]?)
if /i %move%==y (if not exist “%homepath%\Desktop\SM backup scripts” (md “%homepath%\Desktop\SM backup scripts”))
if /i %move%==y (echo. All the scripts will be moved to your desktop. & timeout /t 5 /nobreak & move /y “.\Create backup SM(Survival).bat” “%homepath%\Desktop\SM backup scripts”)

echo off
cd “%ProgramFiles(x86)%\Steam\steamapps\common\Scrap Mechanic”
if not exist “.\Survival Backups” (md “.\Survival Backups”)
if not exist “.\Survival Backups\SUN.tmp” (set /p UserName=Enter your steam user folder name:) ^
else (set /p UserName="" <".\Survival Backups\SUN.tmp")
if not exist “.\Survival Backups\SUN.tmp” (echo %UserName%> “.\Survival Backups\SUN.tmp”)
set un=%UserName:~0,5%
if not “%un%”==“User_” (echo Wrong steam user folder name. & set /p r=Want to reset the script [Y/N]?)
if /i “%r%”==“y” (del “.\Survival Backups\SUN.tmp” & pause & exit)

set /p WorldName=Enter world name (use format “World name.*”):
set wn=%WorldName:~-2%

if not %wn%==.* (@echo. Wrong world name format & timeout /t 5 & exit)

@echo =====Making a backup file…
@echo off
cd C:
copy /y “%homepath%\AppData\Roaming\Axolot Games\Scrap Mechanic\User%UserName%\Save\Survival%WorldName%” ^
“%ProgramFiles(x86)%\Steam\steamapps\common\Scrap Mechanic\Survival Backups”

P.s. issue solved, I just needed to set all my variables to something (like “0”), at the start of this code.

1 Like