1.

Solve : check if Multiple Network Drives exist then Launch Application?

Answer»

I have 6 network drives that host applications, and are PUBLISHED in Terminal server. I currently use the batch FILE below to check for one network drive. I need help making this script check 6 network drives if they exist, if they do launch an APP. I tried various forms of if statements but wasn't successful. I am new to batch SCRIPTING, so your help is greatly appreciated.

echo off
IF EXIST T:\ (
GOTO SKIPPED
) ELSE (
NET USE T: "\\server1\data"
)
:SKIPPED
start "" "C:\directory\program.exe"You are kind of on the right path. You can use a FOR command to iterate through all the paths you have to check. Then use an IF EXIST as the DO part of the FOR command and add to a variable each time the IF is TRUE.
Then it is just a matter of checking to see if your counter variable is EQUAL to 6.Squashman has given you the advice - I'm just following up with a suggestion in code.

Code: [Select]echo off
set "skipped="
for %%a in (J K L M N O) do if not exist %%a:\ set skipped=1
if not defined skipped start "" "C:\directory\program.exe"Foxidrive I like that logic better.



Discussion

No Comment Found