Using .cmd Batch Files


  1. Posts : 3
    Windows 7 Pro 64 Bit
       #1

    Using .cmd Batch Files


    I use RoboCopy in .cmd Batch files, is there a way to exit like "Exit Sub" in Visual Basic
    Is it possible to do Visual Basic like Logic Statements?
    Would it be possible to, within the batch file, determine whether a Drive Letter exists, Then run robocopy if it does?
      My Computer


  2. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #2

    IndieArchive said:
    I use RoboCopy in .cmd Batch files, is there a way to exit like "Exit Sub" in Visual Basic
    What does a way of existing have to do with Robocopy?

    IndieArchive said:
    Is it possible to do Visual Basic like Logic Statements?
    Yes. Which statement(s) would you like to replicate in batch? Batch can do most things any other language can, though you'll find to do those things you'll have to follow a few quirks.

    There is profuse info about batch on the Net. A Google search will give you results quicker than a forum can for this.

    IndieArchive said:
    Would it be possible to, within the batch file, determine whether a Drive Letter exists, Then run robocopy if it does?
    Of course. A command line as simple as
    Code:
    if exist D: robocopy blah blah
    will do the trick. And sometimes I even find myself doing
    Code:
    fsutil fsinfo drives | find "D:" >NUL && robocopy blah blah
    in case permissions on the drive were bad.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 16:06.
Find Us