On 1/8/2013 08:38, bartels wrote:
On 01/08/2013 04:14 PM, Warren Young wrote:
On 1/8/2013 06:59, bartels wrote:

The windows format.com

format.com hasn't existed since the DOS days.

That may very well be true, but I have a friend called locate:

I *had* a friend called "which", but he didn't find it.

I have now unfriended him. ;)

My question is this: which device in /dev do I use?

According to [this][1] it's probably /dev/sdb.  But please do read
through what I pointed you to first, and check its applicability
carefully before attempting this.

'Probably' is not good enough when the goal is targeted destruction :)

In that case, you shouldn't be looking at /dev names anyway. They're assigned in order of device discovery, so the device that gets called /dev/sdb or whatever depends on what happened before your code ran.

Actually, it's even worse than that.

In Disk Management, you can permanently assign a USB key a different drive letter than the default. Now when you put it in, it appears somewhere other than code blindly hard-coded with a /dev name expects.

Or, put two USB keys in, one gets called F: (say) and the other G:. Remove both. Now plug the second back in...it's still called G:! Hence, it gets a different /dev name.

If this were Linux, I'd suggest basing your script's logic on device or filesystem UUIDs, but I don't know how to do that under Cygwin.

Does windows leave a trail when mounting?

Oh, doubtless there's something buried in the NT device namespace, mentioned in the document I pointed you to. Maybe you could dump two copies of it and diff(1) them, and assume that the one line that appears in the output is the new device. Ugh.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to