Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to mount and unmount on windows [closed]

I am running a test that includes mounting and unmounting a USB device.

The test is run on both Linux and Windows. Linux is obviously not an issue, but is there a way, preferably by means of Python, to do this on Windows? Or better yet, is there a library that is cross-compatible, and that would do that for each OS?

like image 330
homeGrown Avatar asked Nov 06 '15 14:11

homeGrown


1 Answers

You may need install Desktop-Experience package

try the following code:

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")

for eject DisMount-DiskImage C:\path\English.iso

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

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

like image 69
Ravichandra Avatar answered Oct 08 '22 05:10

Ravichandra