Using .cmd Batch Files

IndieArchive

New member
Local time
8:01 PM
Messages
3
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

Computer type
PC/Desktop
OS
Windows 7 Pro 64 Bit
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?

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.

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

Computer type
PC/Desktop
OS
Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
Back
Top