Windows Command Line

A-KO

n00b
Joined
Nov 18, 2004
Messages
4
I'm wondering if anyone here would have a bit of experience parsing commandline variables. My dilemma is this:

I'm building a custom context menu to copy files (or folders) from one location to another. Now it's working pretty well, with the exception that if I highlight a folder and run xcopy on that folder, it simply copies the files within that folder to the destination as opposed to creating the folder there and placing the files inside of it.

My command for this looks like:

cmd /c xcopy /e "%1" \\server\share\

Now the thing I thought about was maybe attempting to do this with a batch file. Run say, copy-site.bat which creates the remote directory then copies the files to it. But this doesn't go over well since %1 is the full pathname (i.e. C:\Documents and Settings\User\test) to the location as opposed to relative (test).

Now I have been able to do an alternative here, by adding a shortcut into the "Send To" location, which makes this a lot easier since it's integrated into Windows and doesn't have this shortfall--but I'd much rather have it directly on the context menu as opposed to in Send To.

Anyone know of any alternative ways to do this without having to have some program loaded 24/7?
 
if you want to create the folder structure with xcopy, use the /T switch and see if that works.

Also, I would map to the unc path first and then do the xcopy. Like this

net use x: \\server\share
cd x:
xcopy /E /T "%1" .\
net use /D x:

You can put that in a .cmd file and still call it with cmd /c filename.cmd I belive...

Hope this helps!!!

Joe
 
What language is this in? You can copy stuff without createprocessing a cmd window. (Your application will look real unproffesional that way.)
 
Back
Top