Mount [v1.0]

Author: Tuncay Last Modified: 20100305


Mount is a wrapper function to the Windows system core program subst reference.

Mount([SourcePath], [Mountpoint], [Options])
Mount_GetMount([Path])
Mount_GetMountPathes([Variable])
Mount_UnMount([Mountpoint], [Options])

For more details of the functions's parameters and return value, please see it's source code.

Remarks

subst.exe: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/subst.mspx

For update's details and remarks related to the functions, please see the AutoHotkey Forum: http://www.autohotkey.com/forum/viewtopic.php?t=17090

License

The functions is an open source item under the GNU LGPL license. For details, please see lgpl-3.0.txt

Example

; #Include Mount.ahk
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

; Select source folder
FileSelectFolder, SourcePath, ::{20d04fe0-3aea-1069-a2d8-08002b30309d}, 3, Select folder to mount

If (ErrorLevel = 0)
{
	; Mount to first free drive
	path := Mount(SourcePath)

	; Open that drive and wait until MsgBox is closed for unmount
	MsgBox %SourcePath% mounted to %path%
}

Mount_GetMountPathes(pathes)
If (pathes != "")
{
	MsgBox, 4,, Unmount all these mounts?`n`n%pathes%
	IfMsgBox, Yes
	{
		Loop, Parse, pathes, `n
		{
			StringLeft, path, A_LoopField, 1
			If (path)
			{
				Mount_UnMount(path)	
			}
		}
	}
}