'I'm not sure if my if statement syntax in this batch file is correct
I have tested the robocopy and the Start clone hero commands on their own and have had them working before. The code also seems to not run the last two lines even if both of the if statements evaluate to false.
@echo off
:start_update_prompter
set "UPDATE=0"
set /p INPUT="Download New Songs? (Y/N) "
if "%INPUT%" == "Y" set /A UPDATE=1
if "%INPUT%" == "y" set /A UPDATE=1
if "%INPUT%" == "N" set /A UPDATE=0
if "%INPUT%" == "n" set /A UPDATE=0
if "%UPDATE%" == "1" (
robocopy "G:\My Drive\Clone Hero Songs-Shared" "C:\Users\strac\Documents\Clone Hero Songs" /mir /v /E
echo Finished Downloading
sleep 2
START "Clone Hero Launcher.exe" "D:\Users\strac\AppData\Local\Programs\Clone Hero Launcher\Clone Hero Launcher.exe"
::START "GuitarSniffer.exe" "C:\Users\strac\AppData\Roaming\Clone Hero Launcher\Guitar Sniffer\guitarsniffer\GuitarSniffer.exe"
exit
)
if "%UPDATE%" == "0" (
START "Clone Hero Launcher.exe" "D:\Users\strac\AppData\Local\Programs\Clone Hero Launcher\Clone Hero Launcher.exe"
::START "GuitarSniffer.exe" "C:\Users\strac\AppData\Roaming\Clone Hero Launcher\Guitar Sniffer\guitarsniffer\GuitarSniffer.exe"
exit
)
echo Invalid Input
goto start_update_prompter
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
