Link to home
Start Free TrialLog in
Avatar of adkry
adkryFlag for United Kingdom of Great Britain and Northern Ireland

asked on

How to make the Partion Letter for my memeory stick static ?

Hello Guys,

I've got a memory stick, and I want to keep the partion letter constant anywhere I use my memory stick, for example whenever I insert my memory stick in any computer, I want to get the letter T: , so if my memory stick had the folder called 'example'. this folder will always be T:\example\

Now, that question was asked on Experts Exchange before, https://www.experts-exchange.com/questions/26722200/How-to-fix-the-drive-letter-of-a-portable-hard-disk-or-usb.html , upon the answers, I made these 2 files and put them in the root folder of my memory stick.

autorun.inf
[autorun]
label=MH Memory
Action=Check USB Drive on T
shellexecute=drived.cmd

Open in new window


DRIVED.CMD
SET USBDRIVE=T
SET CURRENTDRIVE=%~d0
SET WRONGVOLUME=
SET CURRENTVOLUME=

IF /i "%CURRENTDRIVE:~0,1%" == "%USBDRIVE%" EXPLORER.EXE /ROOT,%~d0\

CD /d %temp%

ECHO list volume>diskpart.txt

for /f "tokens=2" %%a in ('diskpart /s diskpart.txt ^| FIND /i " %CURRENTDRIVE:~0,1% "') do Set CURRENTVOLUME=%%a
for /f "tokens=2" %%a in ('diskpart /s diskpart.txt ^| FIND /i " %USBDRIVE% "') do Set WRONGVOLUME=%%a

DEL DISKPART.TXT
IF Defined WRONGVOLUME (
    echo SELECT VOLUME %WRONGVOLUME% >>DISKPART.TXT
    echo REMOVE LETTER=%USBDRIVE% >>DISKPART.TXT
)

echo SELECT VOLUME %CURRENTVOLUME% >>DISKPART.TXT
echo ASSIGN LETTER=%USBDRIVE% >>DISKPART.TXT

IF Defined WRONGVOLUME (
    echo SELECT VOLUME %WRONGVOLUME% >>DISKPART.TXT
    echo ASSIGN LETTER=%CURRENTDRIVE:~0,1% >>DISKPART.TXT
)
DISKPART /s DISKPART.TXT
DEL /q DISKPART.TXT

Open in new window


They work fine on my laptop, the problem is it doesn't work in public pc's where I don't have admin privileges, is there some way to overcome this problem? I desperately need to fix this issue, i.e. when double-clicking driver.cmd it doesn't change the drive letter at all in public pc's :(

Please Help
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of adkry

ASKER

USBDLM requires admin priveleges to install as well, seems there's no way around this.