G
Guest
Guest
Archived from groups: microsoft.public.win2000.general (More info?)
Hello,
I'm trying to create basic .bat script that will copy a file from one place
to another. I can get it to work, but it's really slow depending on how I do
it and I want to speed it up. Let's just say I'm new to scripts but I have
made an honest effort looking through Technet's scripting site (without an
answer to my question)....
The file I want to copy is located on a different computer (computer 2, a
file server) than which I am trying to execute the script from (computer 1,
a client PC). And, the file is going from one folder to another on the same
remote computer (2). The purpose of this is to place a shortcut to the
script in the Windows startup folder of several client computers, so that
when a person logs on the script runs and automatically updates a file to the
newest version before the users get a chance to open it. Each user will have
their own script. This will save me time so I don't have to manually track
users down, ask them to back out of the file, copy the file, then tell them
it's ok to open back up. Instead, users will get the latest version simpy by
rebooting.
If I type the script to go to a local mapped drive on computer 1, the script
works, but it's REALLY slow to copy the file because it's doing it through my
own computer. If I move the script file to the remote computer 2 (a W2k
server), then the script runs nice and fast the way I want it to. However, I
don't know how to execute the script so that it runs on the remote computer 2
but executed from computer 1.
For example, I can execute the script from computer 1 with:
U:
cd.. subfolder1
cd.. subfolderA (so now I am in U:\subfolder1\subfolderA)
copy somefile.doc U:\subfolder2
where the "U" drive is a local mapped drive on computer 1 pointing to a
shared folder on the D drive of computer 2. This will work, but again it's
really slow. It copies U:\subfolder1\subfolderA\somefile.doc and places it
in U:\subfolder2\.
If I go straight to that server and modify the code so it runs locally on
computer 2 (w/o any interaction with computer 1):
D:
cd.. subfolder1
cd.. subfolderA (so now I am in U:\subfolder1\subfolderA)
copy somefile.doc D:\subfolder2
this code does the same thing, but it runs much faster!
I tried placing the .bat script file on computer 2, make a shortcut to it
and put it on computer 1. Then I modified the code so that it would try to
go to the UNC name of computer 2 when executed from computer 1 but the
command prompt apparently doesn't support that (an error message tells me
so).
\\computer2\D$
cd subfolder1
cd subfolderA
copy somefile.doc D:\subfolder2
If I get rid of "\\computer2\D$" line, then computer1 tries to go to it's
own drive D which computer 1 doesn't have and I get an error. Computer 2 has
the drive D, but I can't get the client computer 1 to recognize 2's D drive.
Clear as mud? Any help would be greatly appreciated!
--
Thanks,
MN4runner
Hello,
I'm trying to create basic .bat script that will copy a file from one place
to another. I can get it to work, but it's really slow depending on how I do
it and I want to speed it up. Let's just say I'm new to scripts but I have
made an honest effort looking through Technet's scripting site (without an
answer to my question)....
The file I want to copy is located on a different computer (computer 2, a
file server) than which I am trying to execute the script from (computer 1,
a client PC). And, the file is going from one folder to another on the same
remote computer (2). The purpose of this is to place a shortcut to the
script in the Windows startup folder of several client computers, so that
when a person logs on the script runs and automatically updates a file to the
newest version before the users get a chance to open it. Each user will have
their own script. This will save me time so I don't have to manually track
users down, ask them to back out of the file, copy the file, then tell them
it's ok to open back up. Instead, users will get the latest version simpy by
rebooting.
If I type the script to go to a local mapped drive on computer 1, the script
works, but it's REALLY slow to copy the file because it's doing it through my
own computer. If I move the script file to the remote computer 2 (a W2k
server), then the script runs nice and fast the way I want it to. However, I
don't know how to execute the script so that it runs on the remote computer 2
but executed from computer 1.
For example, I can execute the script from computer 1 with:
U:
cd.. subfolder1
cd.. subfolderA (so now I am in U:\subfolder1\subfolderA)
copy somefile.doc U:\subfolder2
where the "U" drive is a local mapped drive on computer 1 pointing to a
shared folder on the D drive of computer 2. This will work, but again it's
really slow. It copies U:\subfolder1\subfolderA\somefile.doc and places it
in U:\subfolder2\.
If I go straight to that server and modify the code so it runs locally on
computer 2 (w/o any interaction with computer 1):
D:
cd.. subfolder1
cd.. subfolderA (so now I am in U:\subfolder1\subfolderA)
copy somefile.doc D:\subfolder2
this code does the same thing, but it runs much faster!
I tried placing the .bat script file on computer 2, make a shortcut to it
and put it on computer 1. Then I modified the code so that it would try to
go to the UNC name of computer 2 when executed from computer 1 but the
command prompt apparently doesn't support that (an error message tells me
so).
\\computer2\D$
cd subfolder1
cd subfolderA
copy somefile.doc D:\subfolder2
If I get rid of "\\computer2\D$" line, then computer1 tries to go to it's
own drive D which computer 1 doesn't have and I get an error. Computer 2 has
the drive D, but I can't get the client computer 1 to recognize 2's D drive.
Clear as mud? Any help would be greatly appreciated!
--
Thanks,
MN4runner