|
Answer» Here's my problem:
I need to copy the same file off of multiple computers. I have written a command file to copy the files to my flash drive but need to separate the files by the date, then by the computer they were copied from, so they would end up:
f:\today's date\computer name\file.txt
I have the date covered, but would like the command file to read the computer's name and PLUG it into the address above.
As far as I can tell, I'd use the hostname command. I have tried assigning it to a variable but couldn't get it to work!
Any thoughts?
Also, I have tried to copy a folder and the command file asked me if it's a file or directory. How would I have it know it's a directory automatically?
THANKS IN ADVANCE!!Few ways to do this:
for /f %%a in ('hostname') do f:\today's date\%%a\file.txt
OR if you're using XP or 2000
f:\today's date\%computername%\file.txt
This may get you started. I don't think this will work.
The hostname will always give you computer name.
You will have to use some type of telnet for this. VIBHOR is correct. Hostname or Computername will generate the name of the local computer not the REMOTE computer. Perhaps you could post your command file. It might shed some light on the solution.
There are some AUTOMATED telnet scripts.
You can use those. or you can beforehand prepare a list of hostnames.Actually, Sidewinder was right. The ComputerName command worked - I was accessing these MACHINES locally, not throught the network.
THANKS!!![/b]What's this ComputerName command?ComputerName is not a command but an environment string set in XP/2000. Especially useful when customizing scripts to be run on multiple machines. Returns the local computer name.
Access is with %computername%
Gotcha!!
|