bishooman Posted July 31, 2009 Share Posted July 31, 2009 is there any way to give my usb hdd a fixed letter so it is uses same letter in any pc i plugit on ? Link to comment Share on other sites More sharing options...
jaclaz Posted July 31, 2009 Share Posted July 31, 2009 (edited) is there any way to give my usb hdd a fixed letter so it is uses same letter in any pc i plugit on ?Yes and NO.What do you mean by "any pc", "any pc running any OS" or "any pc running same OS, say XP"?In any case on first connection of the USB HDD each system will assign a letter automatically, see here also:http://www.uwe-sieber.de/usbdlm_e.htmlWhat you can do, once windows has assigned it's "automatic" drive letter, is to detect which one is it and change it to "your" default one (provided it is not already occupied).A batch should be able to do this, by using MOUNTVOL and some small third part utility, like dd for windows, or internal diskpart/WMIC.A "drive detecting" batch is given here:http://www.boot-land.net/forums/index.php?...;showtopic=8219another couple ones by victor888 is here:http://www.msfn.org/board/index.php?showtopic=123929&hl=http://www.msfn.org/board/index.php?showtopic=124539&hl=Just to give you some ideas. jaclaz Edited July 31, 2009 by jaclaz Link to comment Share on other sites More sharing options...
bishooman Posted July 31, 2009 Author Share Posted July 31, 2009 i have a usb drive and i have wrote a small batch file to copy files from usb to the hard disk "C:\" but the problem is it is working on my system because the usb is always have the letter F: on my system however it is not working on other systems becase drive letter is being changedanother workorund will work for me if i can use volume name instead of drive letter for copyingthanks Link to comment Share on other sites More sharing options...
jaclaz Posted July 31, 2009 Share Posted July 31, 2009 i have a usb drive and i have wrote a small batch file to copy files from usb to the hard disk "C:\" but the problem is it is working on my system because the usb is always have the letter F: on my system however it is not working on other systems becase drive letter is being changedanother workorund will work for me if i can use volume name instead of drive letter for copyingthanksThis is an entire new question.If you RUN the batch from the SAME USB drive where the files to be copied are, you DO NOT need to hardcode the USB drive letter anywhere.Please post/attach your batch.And/or search about variable expansion of the 0 (zero) parameter of batches (the name of the batch itself).You can now use the following optional syntax:%~i - expands %i removing any surrounding quotes (")%~fi - expands %i to a fully qualified path name%~di - expands %i to a drive letter only%~pi - expands %i to a path only%~ni - expands %i to a file name only%~xi - expands %i to a file extension only%~si - expanded path contains short names only%~ai - expands %i to file attributes of file%~ti - expands %i to date/time of file%~zi - expands %i to size of file%~$PATH:i - searches the directories listed in the PATH environment variable and expands %i to the fully qualified name of the first one found.If the environment variable name is not defined or the file is not found by the search, then this modifier expands to the empty stringThe modifiers can be combined to get compound results:%~dpi - expands %i to a drive letter and path only%~nxi - expands %i to a file name and extension only%~fsi - expands %i to a full path name with short names only%~dp$PATH:i - searches the directories listed in the PATH environment variable for %i and expands to the drive letter and path of the first one found.%~ftzai - expands %i to a DIR like output lineIn the above examples %i and PATH can be replaced by other valid values.I.e. make a batch with :ECHO %~d0ECHO %~dp0ECHO %~dpn0ECHO %~dpnx0and run it from the USB stick.jaclaz Link to comment Share on other sites More sharing options...
iamtheky Posted July 31, 2009 Share Posted July 31, 2009 If you are just copying the same files from your usb to the local disk, how about some relative path action.like copying everything in the batch files current directory xcopy .\*.* c:\ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now