Batch help

Soldato
Joined
2 Aug 2004
Posts
8,373
Location
Buckinghamshire
Code:
FOR /F "tokens=1 skip=1 delims=<tab><space>" %%G IN ('adb.exe devices ^|find "device"') DO SET handset=%%G
IF DEFINED %handset% (
	GOTO UINPUT
	) ELSE (
	ECHO  HTC Desire not detected!
	ECHO  Please ensure the following are true:
	ECHO   - Your HTC Desire is connected via USB
	ECHO   - You've quit HTC Sync on your computer (Right click icon and exit in task tray)
	ECHO   - USB Debugging is enabled in the phone's settings
	ECHO   - USB "Charge Only" mode is selected
	ECHO   - No applications are trying to mount the SDCard (e.g. DoubleTwist/WinAMP)
	)

Getting a syntax error on the above code, I know it's down to the IF DEFINED statement but can't see the issue?

Can you even use the else statement in this example? :confused:

Thanks
 
I'd say

IF DEFINED %handset% GOTO UINPUT
ECHO HTC Desire not detected

You shouldn't need the else statement and brackets as its already going to read that line.
 
Last edited:
Back
Top Bottom