How to mount and unmount windows

I am running a test that involves installing and unmounting a USB device.

The test runs on both Linux and Windows. Linux is obviously not a problem, but is there a way, preferably with Python, to do this on Windows? Or even better, is there a library that is cross-compatible and this will do it for every OS?

+8
python linux windows mount
source share
1 answer

You may need to install the Desktop-Experience package

try

 import platform if(platform.system()== "Windows"): os.system('PowerShell Mount-DiskImage C:\path\ConsumerPreview-32bit.iso') #as mount operates only in powershell elif (platform.system() = "Linux"): os.system("mount /dev/dvdrom /mount-point") 

to extract DisMount-DiskImage C:\path\English.iso

and for information Get-DiskImage C:\path\English.iso | Get-Volume Get-DiskImage C:\path\English.iso | Get-Volume

You can use mount os.path.join to combine paths

0
source share

All Articles