A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Windows 10 » Windows 10 Help Forum
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

What solution do you use to figure out what USB drive letter in a Windows scripted command?



 
 
Thread Tools Rate Thread Display Modes
  #16  
Old September 6th 20, 01:16 AM posted to alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Arlen Holder
external usenet poster
 
Posts: 186
Default What solution do you use to figure out what USB drive letter in a Windows scripted command?

On Sat, 5 Sep 2020 13:20:58 -0400, Big Al wrote:

Just hope you don't have ?:\software on two drives.


We have to choose _something_ to identify the drive.

I would have loved to identify the volume label, or, better yet, the device
serial number, but I didn't find any examples on the net that were even
close.

For finding the serial number, Poutnik proposed a Nirsoft utility, which
not only easily reports the serial number, but also (if you're an admin),
allows simply right-click change of the drive letter.
https://www.nirsoft.net/utils/usb_devices_view.html
https://www.nirsoft.net/utils/usbdeview-x64.zip
Name: USBDeview.exe
Size: 189816 bytes (185 KiB)
SHA256: 0C93E5C815BA258750CE4762A4CDB8FA746B05D525BD463ED6 DBE243CD790FB2

Running USBDeview and comparing to the Microsoft and the Sieber usbview,
this Nirsoft utility is the same but different in a whole bunch of ways.

It presents the USB data in a columnar fashion, one row per USB device,
where my USB stick in question showed up as a named drive letter, a given
serial number, etc.

In summary, we have to key off of "something" to identify the drive:
a. The serial number of the USB device
b. The volume name of the USB device
c. The label of the USB device
d. The mount point (aka Drive Letter) of the USB device
e. A filespec on the USB device
etc.

Of all these things, I prefer the "serial number" as we can presume that's
"most" unique (for some value of uniqueness); but I don't even know how to
programmatically obtain the serial number of a mounted USB volume.
https://hatsoffsecurity.com/2014/06/05/usb-forensics-pt-1-serial-number/

Googling, I see these commands report serial numbers of all drives
but strangely enough, they each report a _different_ serial number
for the same USB device!
o Win+R %comspec% /k vol j:
o Win+R %comspec% /k wmic diskdrive get Model, Name, InterfaceType, SerialNumber

In summary, one solution to avoid the problem you speak of where
two USB drives may have the same filespec, is to modify the
script to identify the USB stick by it's "unique" serial number
--
Usenet allows purposefully helpful people to suggest & share ideas.
Ads
  #17  
Old September 6th 20, 09:34 AM posted to alt.comp.os.windows-10
R.Wieser
external usenet poster
 
Posts: 1,302
Default What solution do you use to figure out what USB drive letter in a Windows scripted command?

Arlen,

For finding the serial number, Poutnik proposed a Nirsoft utility


You have crossposted into a few newsgroups, implicitily telling us you want
to have the solution also work there. I don't think there are many
programs that will work as well under MSDOS as well as the full range of
Windows versions (in both 32 as well as 64 bit variants) (and I will not
even consider Win 3.x there :-) )

The loop and check for a certain file/folder should work on any of them
(which is why I suggested the latter).

And by the way: You can ofcourse create a file/folder with a name taken from
the data that that Nirsoft utility returns or which you can find yourself
using standard commands/utilities provided with the OS. That gives you the
best of both worlds : A (supposedly!) unique ID taken from the stick itself,
while still being able to use the stick in any of the implied OSes.

Or you can just run a GUID generator and use that as the file/folder name
....

In summary, we have to key off of "something" to identify the drive:
a. The serial number of the USB device
b. The volume name of the USB device
c. The label of the USB device
d. The mount point (aka Drive Letter) of the USB device


Neither a, b or c are considered to be unique. At least b and c can be
altered by the (non-admin) user himself.

As for d ? You're pulling our leg, right ? The very problem you started
with is that that one is not even constant. If it where this whole thread
would not have existed in the first place :-)

Regards,
Rudy Wieser



  #18  
Old September 6th 20, 11:31 AM posted to alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Arlen Holder
external usenet poster
 
Posts: 186
Default What solution do you use to figure out what USB drive letter in a Windows scripted command?

SIDE NOTE:

In an attempt at assessing which of the two is most useful for my needs, I
was monitoring USB comings and goings using the Nirsoft USBDeview utility
Poutnik suggested alongside the Sieber USBTreeView utility Paul suggested.

My goal was to use them for a day or two, and choose the one I like best.

On one monitor I had both Nirsoft USBDeview & Sieber USBTreeView running,
and wouldn't you know it. At some point in time, I heard the classic USB
disconnect and then re-connect sounds, and glanced at the USB viewers.

In Paul's suggested Sieber USBTreeView, the line for the USB mouse was
green, and no other line seemed highlighted. So it's the USB mouse!

Note: At first, I only saw the green because I missed the red, but when I
tested it by pulling out the cord, it goes red first and then green when
reconnected and then within a second or so, it goes back to transparent.

That's a neat hardware debugging tool for intermittent USB disconnects!

Given that works so well, if you have an intermittent issue with USB
devices disconnecting momentarily, then I would suggest keeping Paul's
suggested Sieber USBTreeView running, so that, when it happens, you can
visually see which device is disconnecting and then reconnecting.
--
The great thing about solving one problem is it usually solves even more.
  #19  
Old September 10th 20, 04:55 AM posted to alt.comp.os.windows-10,alt.msdos.batch,alt.comp.microsoft.windows
Loren[_2_]
external usenet poster
 
Posts: 1
Default What solution do you use to figure out what USB drive letter in a Windows scripted command?

On Sat, 5 Sep 2020 19:40:43 -0000 (UTC), Arlen Holder wrote:

On Sat, 05 Sep 2020 14:51:50 -0400, Paul wrote:

Microsoft usbview.exe superceded by
Microsoft uvcview2.exe (Win7 SDK) superceded by
https://www.uwe-sieber.de/usbtreeview_e.html

The latter preferred because you can actually find it
when you need a copy. Has added USB3 functions.

The usbview has an obvious name.

The UVC stands for USB Video Class, which is a standard class
driver for webcam like devices. But it just continues to display
config space information like the other one.


Hi Paul,

Even though I had never heard of this "usbview" utility until now...

You convinced me that your suggested USBview is _better_ than the MS one!
o Thank you for being purposefully helpful in your suggestions & advice.

One test alone was sufficient for you to make me into a believer:
https://i.postimg.cc/2SSN3bKR/usbview01.jpg
a. The Sieber USBview provides far more useful readable output
b. Than does the Microsoft USBview from which it's based upon

For one example, the drive letter of the USB stick is clearly shown
o Where, in the Microsoft USBview, the drive letter is not clearly shown



Another similar tool is USBDeview from NirSoft. It gives the USB
device view in table form which can be saved. If you scroll down a bit
it has command line options to Check if a device is
connected/disconnected or enabled/disabled

http://www.nirsoft.net/utils/usb_devices_view.html


Loren
 




Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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






All times are GMT +1. The time now is 11:04 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.