Associates a volume with a drive letter or a directory on another volume
#include <WinAPIFiles.au3>
_WinAPI_SetVolumeMountPoint ( $sFilePath, $sGUID )
$sFilePath | The user-mode path to be associated with the volume. This may be a drive letter (for example, X:\) or a directory on another volume (for example, Y:\MountX). |
$sGUID | The volume GUID path for the volume. This string must be of the form "\\?\Volume{GUID}\" where GUID is a GUID that identifies the volume. The \\?\ turns off path parsing and is ignored as part of the path. |
Success: | True |
Failure: | False |
It is an error to associate a volume with a directory that has any files or subdirectories in it. This error
occurs for system and hidden directories as well as other directories, and it occurs for system and hidden
files.
Search SetVolumeMountPoint in MSDN Library.
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
Local Const $sPath = @TempDir & '\Mount\'
Local $sGUID = _WinAPI_GetVolumeNameForVolumeMountPoint(@HomeDrive & '\')
DirCreate($sPath)
_WinAPI_SetVolumeMountPoint($sPath, $sGUID)
MsgBox($MB_SYSTEMMODAL, '', 'The drive (' & StringUpper(@HomeDrive) & ') has been associated with "' & $sPath & '".')
_WinAPI_DeleteVolumeMountPoint($sPath)
DirRemove($sPath)