Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > microsoft.public.scripting.vbscript > #11167
| From | "Dave \"Crash\" Dummy" <invalid@invalid.invalid> |
|---|---|
| Newsgroups | microsoft.public.scripting.vbscript |
| Subject | Re: Searching drives |
| Date | 2015-10-29 15:25 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <n0trnv$m3t$1@dont-email.me> (permalink) |
| References | <5632621c$0$3179$426a74cc@news.free.fr> |
Youri Ligotmi wrote:
> Hi there
>
> I need to write a script to copy files on different memory sticks,
> that's quite simple (at least I know how to do it). The problem is
> that according to the content of the file I have to copy it on a
> particular memory stick, but the letter assigned to each memory stick
> depends on the order they are plugged on the computer. So I need a
> script that would scan all the local drives, read the name and the
> assigned letter of each one so that I could know that MS1 is assigned
> to the lette E: and MS2 to F: (and the opposite another day). Thanks
> in advance
Here is a simple script I wrote to retrieve the drive letters for MS1
and MS2, using information included in the Windows Scripting Host
reference supplied with Windows.
dim MS1,MS2
call GetStickDrives
msgbox "MS1 = " & MS1 & vbCRLF & "MS2 = " & MS2
Sub GetStickDrives
Dim fso, d, dc
Set fso = CreateObject("Scripting.FileSystemObject")
Set dc = fso.Drives
For Each d in dc
if d.DriveType=1 then
if d.VolumeName="MS1" then MS1=d.DriveLetter
if d.VolumeName="MS2" then MS2=d.DriveLetter
end if
Next
End Sub
--
Crash
Committed to the search for intraterrestrial intelligence.
Back to microsoft.public.scripting.vbscript | Previous | Next — Previous in thread | Find similar
Searching drives Youri Ligotmi <yl@free.fr.invalid> - 2015-10-29 19:14 +0100
Re: Searching drives Youri Ligotmi <yl@free.fr.invalid> - 2015-10-29 19:53 +0100
Re: Searching drives "R.Wieser" <address@not.available> - 2015-10-29 20:17 +0100
Re: Searching drives "Dave \"Crash\" Dummy" <invalid@invalid.invalid> - 2015-10-29 15:25 -0400
csiph-web