skipping C drive

J

joshboski

For some reason this skips over the C drive and instead checks the
work DRIVES


This is what it looks like when it runs

C:\~\Desktop>batch.bat

C:\~>FOR /F "tokens=1,2 delims=\ " %A
IN ('FSUTIL FSINFO DRIVES | MORE /E /T0') DO (
REM Skip N:
IF "%A" == "N:" (echo "skipping N" ) else (
echo "Deleting files from %A"
del /S %A\josh.txt
)
)

C:\~\Desktop>(
REM Skip N((HERE IS WHERE IS MESSES UP DRIVES SHOULD NOT BE HERE BUT
C: SHOULD BE (See below line):
IF "Drives:" == "N:" (echo "skipping N" ) else (
echo "Deleting files from Drives:"
del /S Drives:\josh.txt
)
)
"Deleting files from Drives:"
The filename, directory name, or volume label syntax is incorrect.

C:\~\Desktop>(
REM Skip N:
IF "D:" == "N:" (echo "skipping N" ) else (
echo "Deleting files from D:"
del /S D:\josh.txt
)
)
"Deleting files from D:"
The device is not ready.

C:\~\Desktop>(
REM Skip N:
IF "N:" == "N:" (echo "skipping N" ) else (
echo "Deleting files from N:"
del /S N:\josh.txt
)
)
"skipping N"
 
P

Pegasus \(MVP\)

I suggest you seek the answer in the thread you started on the
same subject only yesterday. It contains the answers to all of
your questions (and probably a lot more!). I think you have
now three threads running on this issue. It is best to stick to
one single thread on any one question.
 
J

joshboski

I stepped through it and I figured out the problem but I dont have a
solution...the output to
FOR /F "tokens=1,2 delims=\ " %A
IN ('FSUTIL FSINFO DRIVES | MORE /E /T0') DO

is

Drives: C:/ D:/ N:/

So it counts Drives: C:/ as one thing, therefore isnt a valid drive..

Im new to using dos and cant for the life of me figure it out
 
P

Pegasus \(MVP\)

joshboski said:
I stepped through it and I figured out the problem but I dont have a
solution...the output to
FOR /F "tokens=1,2 delims=\ " %A
IN ('FSUTIL FSINFO DRIVES | MORE /E /T0') DO

is

Drives: C:/ D:/ N:/

So it counts Drives: C:/ as one thing, therefore isnt a valid drive..

Im new to using dos and cant for the life of me figure it out

You now have at least four threads on this question. Check
the other three for answers, especially the one you started
yesterday.
 
M

Monitor

joshboski said:
I stepped through it and I figured out the problem but I dont have a
solution...the output to
FOR /F "tokens=1,2 delims=\ " %A
IN ('FSUTIL FSINFO DRIVES | MORE /E /T0') DO

is

Drives: C:/ D:/ N:/

So it counts Drives: C:/ as one thing, therefore isnt a valid drive..

Im new to using dos and cant for the life of me figure it out

Here is a way to solve the problem, in case you haven't
received a solution in the many other threads you started:
@echo off
setlocal EnableDelayedExpansion
FOR /F "tokens=1 delims=\" %%A IN ('FSUTIL FSINFO DRIVES ^| MORE /E /T0') DO
(
set Drive=%%A
set Drive=!Drive:drives: =!
IF "!Drive!"=="N:" (
echo Skipping drive !Drive!
) else (
echo Deleting files from !Drive!
del /S "!Drive!\FILE1"
)
)
BTW, this won't work in DOS. There is no DOS in Windows XP,
only a "command prompt".
 
J

joshboski

I apologize, i could not find my way around the forums, and I didnt
know That it was posted several different places.
I now need to skip any CD ROM drives, so when I run FSUTIL FSINFO
DRIVETYPE, it requires a drive following as such:

FSUTIL FSINFO DRIVETYPE %%A , how do I set that as an environmental
string.

It displays like this: C: - Fixed Drive
D: - CD-ROM Drive
N: - Remote/Network Drive
 
P

Pegasus \(MVP\)

joshboski said:
I apologize, i could not find my way around the forums, and I didnt
know That it was posted several different places.
I now need to skip any CD ROM drives, so when I run FSUTIL FSINFO
DRIVETYPE, it requires a drive following as such:

FSUTIL FSINFO DRIVETYPE %%A , how do I set that as an environmental
string.

It displays like this: C: - Fixed Drive
D: - CD-ROM Drive
N: - Remote/Network Drive

I gave you a complete script to do this in one of your other
threads, anticipating that you were posting your question
before fully working out what you wanted. I recommend
you give it a try. Here it is again:
=================
If you want something a little snazzier then you can use this script
file to give you the information you want. You may not need much
of the output that the script gives you - it is easy to remove the
irrelevant code.

Copy and paste the code below into c:\Windows\diskparms.vbs,
then invoke it like so: cscript //nologo c:\windows\diskparms.vbs

Const Removable = 1
Const Fixed = 2
Const Network = 3
Const CDROM = 4
Const RAMDisk = 5

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set drives = oFSO.Drives

NewLine=Chr(10)
Line = ""

For Each drive In drives
Line = Line & "Drive " & drive.Path
Line = Line & " " & ShowDriveType(Drive)
If drive.IsReady _
Then Line = Line & ", ready" _
Else Line = Line & ", not ready"

If drive.IsReady Then
If drive.DriveType=Network Then
Line = Line & ", Label=" & drive.ShareName
Else
Line = Line & ", Label=" & drive.VolumeName
End If

Line = Line & ", FS=" & drive.FileSystem
Line = Line & ", Total=" & Int(drive.TotalSize/1000000)
Line = Line & ", Free=" & Int(drive.FreeSpace/1000000)
Line = Line & ", Available=" & Int(drive.AvailableSpace/1000000)
Line = Line & ", Serial=" & Hex(drive.SerialNumber)
End If

Line = Line & NewLine
Next
wscript.echo Line

Function ShowDriveType(Drive)
Select Case drive.DriveType
Case Removable
T = "Removable"
Case Fixed
T = "Fixed"
Case Network
T = "Network"
Case CDROM
T = "CD-ROM"
Case RAMDisk
T = "RAM Disk"
Case Else
T = "Unknown"
End Select
ShowDriveType = T
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top