Accessing remote %systemroot% using UNC
Posted on 2004-11-10
I want to copy a file to or from the %systemroot%\system32 directory on a mix of Windows 2000 and Wndows XP workstations. The systemroot of the Windows 2000 machines is C:\Winnt and the systemroot of the Windows XP machines is C:\Windows. I use a script that loops through a list of workstations, but the repeating command is, for example:
Obviously this will fail on the WIndows XP machines. I would like to use the systemroot variable, but when I try:
it fails because the variable is being resolved on my machine and comes out the wrong syntax anyway (\\<hostname>\c:\winnt...)
How can I use one command that will resolve the remote host's systemroot variable in the copy command? Or what alternatives do I have for accomplishing the same task?