Hello,
I use Windows XP still. I would like to do the following. I have a file like video and I select it in file explorer. I copy it in context menu or by ctrl+c. Now I want to click on icon on my desktop to run a script. The script must to do the following: To mount a certain partition (now there are three disks connected and I can do this manually in MS Disk Manager). So I need to add a letter Y: to the partition I think it is 3rd partition (NTFS). Then I need to open certain folder like SHARED in File rxplorer - so not to do this manually. Then I need to paste the file here. And unmount the partition.
OR - if possible better solution of my problem would be: Do not open the Explorer, but copy the file here: Y:\_SHARED_ ... Because the file to be copied is already marked. I think this would be definitely perfect solution. And then unmount the partition. The last step is very important for me. Can you help me with this. I think I can find how to mount or unmount but not sure how to copy the file - the ctrl+C marked file.
Script for (u)mounting partition and open explorer
Moderator: DosItHelp
Re: Script for (u)mounting partition and open explorer
Here is my old BAT that I was using until I replaced my archive HDD with SSD [thus no longer had to stop the noise being generated by it]
You will have to read through it dough, to know how to adjust it to your needs
You will have to read through it dough, to know how to adjust it to your needs
Code: Select all
:: This will unmount the drive with the letter X assigned to it
::
::
::
:: To write down such a BAT [and its counterpart] for any drive [except probably for C] you need to:
::
:: 1] Open up the Command Prompt as Administrator
::
::
::
:: 2] Run command
::
:: mountvol
::
::
::
:: 3] Copy the whole long gibberish Volume Name appearing above a given drive. It starts with
::
:: \\?\{
::
:: and ends with
::
:: }\
::
::
::
:: 4] Run command
::
:: mountvol @: /p
::
:: where @ stands for the letter of the drive. This will dismount that drive. Do not use >>/d<< which only removes the drive letter assignment
::
::
::
:: 5] Run command
::
:: mountvol @: /p \\?\Volume{########-####-####-####-############}\<<
::
:: where @ stands for the letter of the drive and all those ## stand for its name. This will mount back that drive
::
::
::
:: 6] In case of problems please refer to:
::
:: https://superuser.com/questions/704870/mount-and-dismount-hard-drive-through-a-script-software
::
:: www.instructables.com/id/VBScript-Working-with-mounted-drives
:: And so the current commands are
::
:: mountvol X: /p
::
:: mountvol X: \\?\Volume{9647db15-ae52-43d4-bf80-5adb74be5984}\
::
:: But the problem with all of this is that mountvol only takes case of the mount state and disregards the spinning thus noise [thus the main reason for using such BAT]. Although recently it started to also spin the drive down
::
::
::
:: And also, for a BAT with these commands to work it has to be run a Administrator. And instead of right clicking the BAT and using the "Run as administrator" shell entry, an ordinary shortcut to such BAT can be created for which
::
:: Properties > Shortcut > Advanced > Run as administrator
::
:: checkbox can be selected
::
:: [However if CMD is run as Administrator then strangely somehow only the dismount command works when executed within it]
mountvol X: /p
exit
:: An alternative way to dismount is to use such a BAT:
::
::
::
:: @echo off
::
:: REM Change this to the drive you want to unmount
:: set drive=C:
::
:: echo Unmounting Drive...
:: mountvol %drive% /p
:: echo Drive Unmounted
::
:: pause
:: exit
:: An alternative way to mount back is to use such a BAT:
::
::
::
:: @echo off
::
:: REM Change this to the drive letter you want to mount the drive to
:: set drive=X
::
:: REM Change this to the Volume Name of the drive you want to mount
:: set volume=\\?\Volume{########-####-####-####-############}\
::
:: :start
:: echo Mounting Drive...
:: mountvol %drive%: %volume%
:: echo Drive Mounted
::
:: pause
:: exit
Re: Script for (u)mounting partition and open explorer
You might also want to read this discussion https://community.mp3tag.de/t/achieving ... -10/45914/ and try out using mentioned in it freeware revoSleep for easy temporary mounting and dismounting of volumes