Reply
Batch File Help...
Old 06-18-2007, 04:08 PM Batch File Help...
Brian07002's Avatar
Super Spam Talker

Posts: 798
Name: Brian
Location: United States
Ok,

I am trying to determine what the cd-rom drive letter is, and then add some code to it from a batch file.

Here's what I have so far to determine the cd-rom drive letter:

Code:
FOR /F "tokens=3" %%A IN ('ECHO list volume ^| DISKPART.EXE ^| FIND.EXE "-ROM "') DO SET CDROM=%%A:
CLS
@echo Your CD is %cdrom%
So, If I have:
Code:
@for %%d in (c,d,e,f,g) do copy file.txt %%d:\
How could I exclude the cd-rom drive(s) or ANY drive that is NOT Ready from the above (for obvious reasons, can't copy to the drive)...I know I could just exclude the drive letters for the cd rom (non-ready) drive(s), but we change drive letters often for different reasons...Maybe not often, but we do change them.

Thank you.
-Brian
Brian07002 is online now
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 06-18-2007, 06:21 PM Re: Batch File Help...
Learning Newbie's Avatar
Moderator

Posts: 5,486
Name: John Alexander
In .NET or VBA or VB 6 this would be a very easy thing to do. But you're just simply needing more than you can get out of batch files.

Consider, I have five hard drives, a set of removable drives, a CD R/W drive and a DVD R/W drive. I'm sure lots of people have more than one optical.
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 06-18-2007, 06:38 PM Re: Batch File Help...
Brian07002's Avatar
Super Spam Talker

Posts: 798
Name: Brian
Location: United States
Ok,

Then might it be at even all possible to just suppress the errors while copying if it can't copy to that drive?

Thank you
Brian07002 is online now
Reply With Quote
View Public Profile
 
Old 06-18-2007, 07:35 PM Re: Batch File Help...
Learning Newbie's Avatar
Moderator

Posts: 5,486
Name: John Alexander
Yeah, I'm pretty sure that's possible, although I don't remember how. I think you can set echo off to include output from file commands, and I'm almost positive you can also pipe the output into a file, and append it, so you could keep a status log that way. But I can't stress enough how much better off you'd be with a more recent technology, be it VB, C#, Windows Host Scripting, or something else. If you want to ease deployment, you could put the compiled exe file on a network share and call out to it through a batch file, so not have to install it on the client machine at all.
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Batch File Help...
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12913 seconds with 12 queries