Accessing remote %systemroot% using UNC

Posted on 2004-11-10
Last Modified: 2012-08-13
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:

copy \\<hostname>\c$\winnt\system32\logfile.txt

Obviously this will fail on the WIndows XP machines. I would like to use the systemroot variable, but when I try:

copy \\<hostname>\%systemroot%\system32\logfile.txt

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?

Question by:YEvans
    LVL 15

    Accepted Solution

    Hi YEvans,

    Try \\hostname\admin$

    This should point to the systemroot directory :-)

    Author Comment

    Man I should have known that! I have gotten so used to just using the C$ and D$ admins shares I forgot all about the admin$ share.

    LVL 15

    Expert Comment


    Glad I could help :)

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
    In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now