Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Using .cmd Batch Files

02 Jan 2016   #1
IndieArchive

Windows 7 Pro 64 Bit
 
 
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 System SpecsSystem Spec
.
04 Jan 2016   #2
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Quote   Quote: Originally Posted by IndieArchive View Post
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?

Quote   Quote: Originally Posted by IndieArchive View Post
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.

Quote   Quote: Originally Posted by IndieArchive View Post
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 System SpecsSystem Spec
Reply

 Using .cmd Batch Files




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Batch files?
hello guys im new to this forum. I'm trying to write a simple batch file which copies a couple of files from a network address to mulitple directories on the C:\ of different pc's eg xcopy from lets say A:\source.file to PC1 (directory user 1 folder, user 4 folder, user 7 folder, default)...
General Discussion
batch files
Can I write simple batch files - example - at 3am xcopy server file to workstation a ?
Software
batch renamming files
Hi, Does anyone know of a program or a fast way to rename filenames similar to this partial list 1bbea_set01_112432_019.jpg 1mbi5_set01_112432_016.jpg 3ppi_set01_112432_022.jpg 3scst_set01_112432_007.jpg 4chxb_set01_112432_017.jpg 5yvc5_set01_112432_006.jpg
General Discussion
Batch files and UAC
Hi. I have a small issue I hope can be resolved to a desired effect (if possible) Whats happening is, I am using a software, that to be used "correctly" requires a parameter to run correctly (2.0 beta type app) Heres what im looking at: The program is a neato reproduction of the HTC...
System Security
Are batch files allowed?
I ask if .bat files are allowed because I have some software that uses a .bat file to install it's pdf printer (Quicken 2009). It seems the file won't run even as administrator and the compatibility wizard won't touch it. I noticed there might be a registry fix to allow it to run, but if...
General Discussion


Our Sites

Site Links

About Us

Find 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 12:01.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App