Conditional BAT File (If Drive Exists) - Run Exe -


i'm trying application run if drive available, or run same application locally if it's not.

currently it's launching application both locations, missing something?

@echo off rem bat file determine launch app if exist i:\ goto launchfromnetwork else goto launchlocally  :launchfromnetwork start i:\application.exe  :launchlocally start c:\applicationfolder\application.exe 

in batch files labels place call or jump, don't create barrier code execution.

@echo off rem bat file determine launch app if exist i:\ goto launchfromnetwork  :launchlocally start c:\applicationfolder\application.exe goto :eof  :launchfromnetwork start i:\application.exe goto :eof 

no need else clause if if not evaluated true, code continues execution on next line, , labels not barriers.

that reason goto :eof in sample, avoiding code execution continue when next section reached


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -