simple batch command?

Discussion in 'Computing, Science, and Technology' started by berky93, Aug 28, 2009.

  1. berky93

    berky93 New Member

    Oct 28, 2007
    Likes Received:
    I need help with a simple batch file I'm making. its a backup program that detects whether or not devices are plugged into S:\ and I:\

    S:\ is my external hard drive, and I:\ is my flash drive.

    I want the program to check which drives are plugged in and based on that perform one of three commands. It's supposed to goto EXIT if no devices are plugged into those 2 drives, goto FLASH if only I:\ is plugged in, and goto FLASHHD if both I:\ and S:\ are plugged in. the problem is, it doesnt work. it only works when both I:\ and S:\ are plugged in. otherwise it immediately closes upon opening. I'm not very experienced at writing batch files, so I don't really know what I did wrong.

    heres the files (with unnecessary commands removed to save space on this post)
    @echo off
    title Files Backup
    IF [NOT] EXIST S:\ goto FLASH
    IF [NOT] EXIST I:\ goto END
    goto FLASHHD
    ECHO Backup will now copy files to and from your I:\ drive.
    (I:\ backup commands)
    ECHO Backup will now copy files to and from your I:\ and S:\ drives
    (I:\ and S:\ backup commands)
    ECHO Please plug a device into drive I:\ and restart this program.
    any ideas?

    EDIT: I couldn't fix the file I showed above, but I found a different way to accomplish what I needed. I made the file check for the S:\ drive right before attempting to exit. if its found, it will skip over to the S:\ backup commands, and not execute the exit command until it reaches it at the end of those backup commands. otherwise it would continue on and exit.

Share This Page