"Sharon Byers" wrote in message
> We have one test web server and 3 production servers. We need to keep the
> prod servers in synch.
>
> Whenever I update a file (*.asp) I have to copy it from the test server to
> the corresponding folder on the other three servers. I have batch files to
> do this for the simplest cases - where I'm copying from the few most used
> directories.
>
> But what I'd like is a way to be logged into the test server folder and just
> type at the command line:
> webcopy myfile.asp
> and have the batch file identify the current directory and copy it to the
> corresponding directory on the 3 prod servers.
>
> I don't want to have to type out the long path, like
> "\myweb\mydir1\subdir1\subdir2\subdir3\subdir4" 3 or 4 times. And I don't
> want to use the Windows folder tree.
>
> I can't find an environment variable that captures the current location
> without the drive letter and colon
....snip
Read the help under FOR /? - in particular the %~ features.
Typical syntax to extract current folder path without drive letter
and colon to a variable:
Lines that don't begin with two spaces have wrapped accidentally
====Begin cut-and-paste (omit this line)
@ECHO OFF
SETLOCAL
FOR %%F IN (%CD%) DO SET Pvar=%%~pnF
ECHO. Path=%Pvar%
====End cut-and-paste (omit this line)
Simulated Win2000 for study/demo use. Cut-and-paste as Batch text file.
Batch file troubleshooting:
http://www.allenware.com/find?UsualSuspects
Expand the variable %Pvar% in any commands you wish.
--
William Allen
Free interactive Batch Course
http://www.allenware.com/icsw/icswidx.htm
Batch Reference with examples
http://www.allenware.com/icsw/icswref.htm
From email address not checked. Contact us at
http://www.allenware.com/