7
I wonder how I can do to disassemble a removable drive(Pen-Drive) via c code#.
7
I wonder how I can do to disassemble a removable drive(Pen-Drive) via c code#.
3
From Windows XP you can use the native command MOUNTVOL
. According to your documentation:
Creates, Labels, or lists a volume mount point.
Mountvol
is a way to link volumes without requiring a drive Letter.
Translating:
Create, delete or list a mount point volume.
Mountvol
is a way to link volumes without the need for a drive letter.
Using its code as the basis, this would be the call without the need for any external component:
private static void EjectDrive(char driveLetter)
{
ProcessStartInfo ps = new ProcessStartInfo("mountvol.exe", driveLetter + ": /d");
Process.Start(ps);
}
Perfect! It worked exactly as expected! No need for external component. I tested it here on Windows 7 and it worked. Obg Onosendai :)
I’m glad it worked, @Rsouza!
2
Once I looked at this link, I was trying to do the same solution and I had found these models, but I no longer needed them, I used file transmission via Dropbox, so I abandoned the project.
who knows gives you a light! :)
http://www.codeproject.com/Articles/13530/Eject-USB-disks-using-C
This article had already taken a look. But it is mt complex, I ended up finding an easier solution :) Obg
2
So, you guys, let’s go I managed to find a program that does this.
http://www.uwe-sieber.de/drivetools_e.html
And I did it that way.
private static void EjectDrive(char driveLetter)
{
ProcessStartInfo ps = new ProcessStartInfo("RemoveDrive.exe", driveLetter + ":");
Process.Start(ps);
}
Along with this Removedrive at the root of the program. Obg Galera.
Browser other questions tagged c# .net
You are not signed in. Login or sign up in order to post.
If you go to a Unix-based system with Mono, it should be the easiest thing in the world, just a Shell command. With Mono or . NET for Windows, I believe that it should be necessary to use the Windows API, which is not so friendly. When I get home I’ll look for a solution, if by then no one has posted a.
– Oralista de Sistemas
I think that’s right @Renan, I’m trying to find some that works only it’s hard. Obg :)
– Rafael Souza
Take a look at the source of this project: http://www.codeproject.com/Articles/13530/Eject-USB-disks-using-C
– Tiago César Oliveira
I was able to solve @Tiagocésaroliveira . Obg for the help.
– Rafael Souza