Thanks.
--
Reply in group, but if emailing add one more
zero, and remove the last word.
It depends on the OS being used.
--
Regards,
Mic
From XP forward. The 2k utilities are a little different, but I don't
really deal with 2k much any more so it's best to forget it. If it can't be
done natively, then utilities from either the resource kit or support tools
or sysinternals are ok.
I'm just giving a pointer here - try this. Wmic is not available on XP Home AFAIK.
@echo off
Wmic path Win32_DiskDrive get /value >file.txt
--
Regards,
Mic
And here is a sample using diskpart. It needs admin access or maybe backup permissions I think.
@echo off
del script.txt 2>nul
>>script.txt echo select disk 0
>>script.txt echo detail disk
>>script.txt echo exit
diskpart /s script.txt >details.txt
del script.txt 2>nul
What is the purpose for finding the drive size? Is it merely to list all drives and capacities in the machine?
--
Regards,
Mic
That's a good one. Thanks.
> What is the purpose for finding the drive size? Is it merely to list
> all drives and capacities in the machine?
No, just to report the size of a backup drive in the emails that my backup
script sends to me.
170} How do I get the total size of a volume, not just the available
space?
http://www.netikka.net/tsneti/info/tscmd170.htm
All the best, Timo
--
Prof. Timo Salmi, Vaasa, Finland
http://www.netikka.net/tsneti/homepage.php
Useful CMD script tricks http://www.netikka.net/tsneti/info/tscmd.php
You may like the output from this too.
@echo off
echo list volume >script.txt
echo exit >>script.txt
diskpart /s script.txt >drvlist.txt
del script.txt
>Can you get the total capacity of a disk using native utils
If you consider VBscript native, you can do this:
set fso = createobject("Scripting.FileSystemObject")
set drive = fso.GetDrive("C:")
wscript.echo "Size: " & drive.TotalSize/(1024^4) & " TB"
There are a few ways to integrate vbscripts into batch. Which one is
best depends on the specific task and your requirements.
--
RoRo
::----- START -----
WMIC LogicalDisk WHERE "DriveType>='2' OR DriveType<='6'" GET
DeviceID,Size
::------ END ------
>Can you get the total capacity of a disk using native utils (without the
>intense operation of listing all directories and adding the total used to
>the free space)?
It will not change very often. So perhaps the simplest way is to use a
utility called Windows, My Computer, select drive, Properties (or
something like that) to find the capacity, and to write the number that
it shows in a small file in the root or other directory that your code
can read. The file can also contain other useful information which the
OS is unlikely to know, such as the colour of a thumb drive. Give the
file a suitable name, such as OWNED-BY, put your name in it, and you
stand a better chance of recovering it if it should become lost.
--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk DOS 3.3 6.20 ; WinXP.
Web <http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <http://www.merlyn.demon.co.uk/batfiles.htm> - also batprogs.htm.
That's very nicely formatted.