[python-win32] Mapping Drives and windows folders

Michael Montagne mmontagne at WalkerMacy.com
Wed Jan 14 19:52:17 EST 2004


I.
I'm using a combination like this to unmap drives so I can remap them due to a machine name change.  But the drive will not disconnect because the share does not exist anymore.  Is there aother way to disconnect a drive?
import win32com.client
wnt=win32com.client.Dispatch('Wscript.Network')
wnt.RemoveNetworkDrive(driveletter)
 
II.
I need to manipulate users desktop contents at startup.  Using vbscript, this works good.
 
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = WScript.CreateObject("WScript.Shell")
Set colEnvironmentVariables = oShell.Environment("Volatile")
 
sFolder = colEnvironmentVariables.Item("APPDATA") & _
    "\Microsoft\Internet Explorer\Quick Launch"
set oFolder=objFSO.GetFolder(sFolder)

sDesktopFolder=oShell.SpecialFolders.Item("Desktop")
set oDesktopFolder=objFSO.GetFolder(sDesktopFolder)

sAllDesktopFolder=oShell.SpecialFolders.Item("AllUsersDesktop")
set oAllDesktopFolder=objFSO.GetFolder(sAllDesktopFolder)

 
 Then I walk the files collection looking for the ones I want to delete.
But I'm having trouble with the Envoronment variables part using python.  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20040114/83820c3c/attachment.html


More information about the Python-win32 mailing list