USB Drive Unmount Command

G

Gene Wirchenko

Hello:

Does anyone know of a command for unmounting a USB drive? I
frequently copy from system to system using batch files, and I would
like it if the drive could be unmounted at the end of the batch file.

Sincerely,

Gene Wirchenko
 
Z

Zaphod Beeblebrox

Hello:

Does anyone know of a command for unmounting a USB drive? I
frequently copy from system to system using batch files, and I would
like it if the drive could be unmounted at the end of the batch file.
To the best of my knowledge there is no native way to do this, but
there are 3rd party tools that allow you to script unmounting/ejecting
a USB drive. I've not used it, but I've seen where deveject.exe is
purported to be able to do this.
 
B

BeeJ

Over all the years of using either a USB HDD or a USB Pen drive I have
never unmounted it before pulling the plug on either and have never had
any problems. This on XP and Vista and Windows 7.
Has anyone had a problem?
 
D

DanS

Hello:

Does anyone know of a command for unmounting a USB
drive? I
frequently copy from system to system using batch files,
and I would like it if the drive could be unmounted at the
end of the batch file.
Hmmmmmm..................

Does mountvol work on USB drives? .......probably not, but

mountvol x: /d

http://ss64.com/nt/mountvol.html






I wonder if this would be of any use to you....

<http://www.howtogeek.com/howto/windows-vista/create-a-shortcut-or-hotkey-to-
immediately-eject-a-specific-usb-drive/>
 
S

Stan Brown

Over all the years of using either a USB HDD or a USB Pen drive I have
never unmounted it before pulling the plug on either and have never had
any problems. This on XP and Vista and Windows 7.
Has anyone had a problem?
An actual problem? No.

An annoying message from Windows the next time I remounted it?
Usually. So I always eject, just to avoid the message. And in so
doing, I also avoid that off chance of an actual problem.
 
R

Roger Mills

Hello:

Does anyone know of a command for unmounting a USB drive? I
frequently copy from system to system using batch files, and I would
like it if the drive could be unmounted at the end of the batch file.

Sincerely,

Gene Wirchenko
Why not just use the built-in "Safely Remove Hardware" icon?
--
Cheers,
Roger
____________
Please reply to Newsgroup. Whilst email address is valid, it is seldom
checked.
 
J

J. P. Gilliver (John)

Roger Mills said:
Why not just use the built-in "Safely Remove Hardware" icon?
Which you call from a batch file, how?
--
J. P. Gilliver. UMRA: 1960/<1985 MB++G.5AL-IS-P--Ch++(p)Ar@T0H+Sh0!:`)DNAf

.... back in the olden days ... Britain was entirely made of wood and lit by
one enormous candle, tended by the Queen
- Steven Moffat, Radio Times, 24-30 July 2010
 
B

BillW50

In
Stan said:
An actual problem? No.

An annoying message from Windows the next time I remounted it?
Usually. So I always eject, just to avoid the message. And in so
doing, I also avoid that off chance of an actual problem.
I have a number of times. Although this was 5 years or more ago and I
don't recall what Windows OS it was. And the worst one had a scrambled
directory. Worse it would randomly popup new filenames with strange
characters. Reformatting fixed the problem. Thank goodness for backups,
as nothing was retrievable.
 
S

Stan Brown

Why not just use the built-in "Safely Remove Hardware" icon?
You quoted the reason: "I frequently copy from system to system using
batch files, and I would like it if the drive could be unmounted at
the end of the batch file."

I do the same thing as Gene, and I have the unmount command as part
of the batch file.
 
V

VanguardLH

Stan said:
You quoted the reason: "I frequently copy from system to system using
batch files, and I would like it if the drive could be unmounted at
the end of the batch file."

I do the same thing as Gene, and I have the unmount command as part
of the batch file.
You mean you do that on some Linux/Unix host since those have the mount
and u[n]mount commands. For Windows, it is mountvol.exe for both
mounting and unmounting (as Dan already mentioned). Or maybe you
installed Cygwin on your installation of Windows to get those *NIX
commands.
 
B

BillW50

In
VanguardLH said:
Stan said:
You quoted the reason: "I frequently copy from system to system using
batch files, and I would like it if the drive could be unmounted at
the end of the batch file."

I do the same thing as Gene, and I have the unmount command as part
of the batch file.
You mean you do that on some Linux/Unix host since those have the
mount and u[n]mount commands. For Windows, it is mountvol.exe for
both mounting and unmounting (as Dan already mentioned). Or maybe you
installed Cygwin on your installation of Windows to get those *NIX
commands.
I am not sure how Stan is going to answer. But the following will do the
job too.

USB Disk Ejector (free)
http://quick.mixnmojo.com/software/usb-disk-ejector

USB Safely Remove (not free, except trial) - I use this one
http://www.safelyremove.com/

Zentimo (not free, except trial) - I use this one too
http://zentimo.com/
 
J

Joerg Jaeger

Hello:

Does anyone know of a command for unmounting a USB drive? I
frequently copy from system to system using batch files, and I would
like it if the drive could be unmounted at the end of the batch file.

Sincerely,

Gene Wirchenko
As far as i know Windows does not use a cache for usb devices unlike *nix.
With *nix you do need really to unmount a usb device since the cache may
not be written completely.
Windows, from what i was reading, does not have the same kind of approach.
Doesn't a simple unmount do the job (if needed)?

--
ACCESS DENIED...

/\_/\
____/ o o \
/~____ =ø= /
(______)__m_m) el cato
 
J

Joerg Jaeger

As far as i know Windows does not use a cache for usb devices unlike *nix.
With *nix you do need really to unmount a usb device since the cache may
not be written completely.
Windows, from what i was reading, does not have the same kind of approach.
Doesn't a simple unmount do the job (if needed)?
Found this on the web. Maybe its of use.
http://blog.ashfame.com/2008/02/saf...-remove-hardware-icon-disappears-system-tray/

--
ACCESS DENIED...

/\_/\
____/ o o \
/~____ =ø= /
(______)__m_m) el cato
 
G

Gene Wirchenko

****************************
* IMPORTANT WARNING BELOW! *
****************************

Hmmmmmm..................

Does mountvol work on USB drives? .......probably not, but

mountvol x: /d
WARNING: Do NOT do this! You probably do not want the result.

This will unmount the volume, but not the USB device. It deletes
the mount point. The USB drive will be recognised when mounted, and
Safely Remove Hardware will work for it, but there will be no drive
letter. Note that this drive letter deletion persists across a
reboot.
The above is what I should have read first. Using it, I was able
to recover.

A bare
mountvol
will give a list of volume names of the form
\\?\Volume{<GUID value>}\
The one you just mucked up will have a statement that there are no
mount points. To patch it up, enter
mount <drive>:\ <volume name>
where <drive> is a drive letter -- I assume an unused one -- and
I wonder if this would be of any use to you....

<http://www.howtogeek.com/howto/windows-vista/create-a-shortcut-or-hotkey-to-
immediately-eject-a-specific-usb-drive/>
This worked. It is a GUI program that also works on the command
line. Any output is GUI.

Sincerely,

Gene Wirchenko
 
G

Gene Wirchenko

****************************
* IMPORTANT WARNING BELOW! *
****************************

Stan said:
You quoted the reason: "I frequently copy from system to system using
batch files, and I would like it if the drive could be unmounted at
the end of the batch file."

I do the same thing as Gene, and I have the unmount command as part
of the batch file.
You mean you do that on some Linux/Unix host since those have the mount
and u[n]mount commands. For Windows, it is mountvol.exe for both
mounting and unmounting (as Dan already mentioned). Or maybe you
installed Cygwin on your installation of Windows to get those *NIX
commands.
DO NOT DO THIS WITHOUT READING UP.

This unmounts the drive letter by deleting the mount point. It
will not unmount the USB device. The deletion persists across
rebooting. See my other post on how to recover.

Sincerely,

Gene Wirchenko
 
J

J. P. Gilliver (John)

[QUOTE="Paul said:
Which you call from a batch file, how?
Maybe find a tool on Uwe's site ?

http://www.uwe-sieber.de/drivetools_e.html#RemoveDrive

http://www.uwe-sieber.de/usbstick_e.html

Paul[/QUOTE]

I think Stan's http://quick.mixnmojo.com/software/usb-disk-ejector looks
like it will do the job too. I was really just pointing out to Roger
that Gene had asked (and Roger had quoted!) for a way that would work in
a batch file, and Roger had suggested using an icon. (I wish I'd kept
quiet now!)
 

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