Deleting a Mounted Folder Program Example
The following program example shows you how to delete a mounted folder by using the DeleteVolumeMountPoint() function.
Create a new Win32 console application project and give a suitable project name.
Add the source file and give a suitable name.
Add the following source code.
void Syntax(WCHAR *argv)
wprintf(L"%s unmounts a mounted volume\n", argv);
wprintf(L" Example: \"%s c:\\mnt\\fdrive\\\"\n", argv);
int wmain(int argc, WCHAR *argv)
// Verify the arguments
if (argc != 2)
// We should do some error checking on the path argument, such as
// ensuring that there is a trailing backslash
bFlag = DeleteVolumeMountPoint(
argv // Path of the volume mount point
wprintf(L"\n%s %s in unmounting the volume at %s\n", argv, bFlag ? L"succeeded" : L"failed", argv);
Build and run the project. The following screenshot is an output sample without any argument.
The following sample outputs show unmounting the previous mounted drive.