Deleting a Mounted Folder
The code example in this topic shows you how to delete a mounted folder by using the DeleteVolumeMountPoint function. For more information, see Creating Mounted Folders.
#define _WIN32_WINNT 0x0501 #include <windows.h> #include <tchar.h> #include <stdio.h> void Syntax (TCHAR *argv) { _tprintf(TEXT("%s unmounts a volume from a volume mount point\n"), argv); _tprintf(TEXT("For example: \"%s c:\\mnt\\fdrive\\\"\n"), argv); } int _tmain(int argc, TCHAR *argv[]) { BOOL bFlag; if (argc != 2) { Syntax (argv[0]); return (-1); } // We should do some error checking on the path argument, such as // ensuring that there is a trailing backslash. bFlag = DeleteVolumeMountPoint( argv[1] // Path of the volume mount point ); _tprintf(TEXT("\n%s %s in unmounting the volume at %s\n"), argv[0], bFlag ? TEXT("succeeded") : TEXT("failed"), argv[1]); return (bFlag); }
本文提供了一个使用 C++ 编写的示例代码,演示如何利用 DeleteVolumeMountPoint 函数删除已挂载的文件夹。该代码适用于 Windows 系统,并展示了如何正确处理路径参数。
1078

被折叠的 条评论
为什么被折叠?



