Specifying by drive name in xcopy?

  • Thread starter Thread starter teleute00
  • Start date Start date
T

teleute00

I'm writing a batch file for a friend so that she can double-click the
shiny icon on her desktop and it'll automatically copy a bunch of stuff
to her USB jump drive. Problem is, I'm afraid that if she ever makes
any changes down the road to her system that might change the drive
letters, that she'll forget to tell me so I can change the .bat. Is
there any way to have the xcopy command work on the drive name instead
of the drive letter? Then I can copy to the drive called Kingston,
rather than e: and hoping e: is right.

Thanks!
 
Or alternately (and suppose more likely), something else to put in the
batch file before the xcopy command, to determine the drive letter of
the drive named "Kingston", and then feed that into the xcopy? Thanks
again.
 
I'm writing a batch file for a friend so that she can double-click the
shiny icon on her desktop and it'll automatically copy a bunch of stuff
to her USB jump drive. Problem is, I'm afraid that if she ever makes
any changes down the road to her system that might change the drive
letters, that she'll forget to tell me so I can change the .bat. Is
there any way to have the xcopy command work on the drive name instead
of the drive letter? Then I can copy to the drive called Kingston,
rather than e: and hoping e: is right.

Thanks!

@echo off
set /p drive=Please enter the target drive letter, e.g. G
if "%drive%"=="" (
echo Program aborted.
echo.
pause
goto :eof
)
xcopy /s /y /c /d "d:\My Documents" "%drive%\Some Folder\"
echo.
pause
 
So this requires the person to enter the drive letter? Because she
wants her mother to be able to do this if she calls and asks, and her
mom will have no idea what to do. She just wants her to be able to
stick in the drive and double click on the icon, then have it be done.

Thanks, though! I'll keep it in mind for other possible scripts...
 
You can obviously set the drive letter yourself
in the batch file without obtaining user input - it
is trivial to code. However, USB devices have
a habit of being visible under different drive letters,
depending on what else gets plugged in . . .
 
You can obviously set the drive letter yourself
in the batch file without obtaining user input - it
is trivial to code. However, USB devices have
a habit of being visible under different drive letters,
depending on what else gets plugged in . . .
This is just one real world example (and there are so many more) of how the
old DOS drive letter bullshit still used by Windoze is such a
pain-in-the-ass for users. We've all heard stories of how software gets
installed on a particular "drive letter", only to stop working later should
that "drive letter" change. It makes so much more sense and is so much more
sophisticated and elegant to be able to mount a particular drive/partition
within the main file system on ones computer so that it never changes and
just becomes part of ones file hiearchy. That's the sophistication one gets
with GNU/Linux. But, Windoze, the toy operating system, keeps its tried and
true methods of locking users into its insane little boxes.

Sea Drives and Dee Drives, indeed! What quaint and old technology. When will
MickeySoft learn? Will Fista overcome this silliness?


--
WGA is the best thing that has happened for Linux in a while.

The ULTIMATE Windoze Fanboy:

http://video.google.com/videoplay?docid=-2370205018226686613

Is this a modern day equivalent of a Nazi youth rally?:

http://www.ntk.net/media/developers.mpg

A 3D Linux Desktop (video) ...


View Some Common Linux Desktops ...
http://shots.osdir.com/
 
Well, yes, of course. But if you read the initial post, that's my
exact fear - that the drive letter will change if something else is
plugged in. That's why I'm trying to find a way to do this by drive
name, instead of letter...
 
You could use this batch file. It sets %drive% to the
drive letter for the disk whose label is "Kingston".
Line1 @echo off
Line2 set Label=Kingston
Line3 set drive=
Line4
Line5 for /F %%a in ('fsutil fsinfo drives ^| find "\" ^| find /i /v
"Drives"') do
fsutil fsinfo VolumeInfo %%a | find /i "%Label%" > nul && set drive=%%a
Line6
Line7 if "%drive%"=="" (echo Device not found) else
(echo The device "%Label%" is mounted on drive %drive%)
 
Back
Top