finding the windows directory in batch script

Posted on 2004-11-16
Last Modified: 2013-12-28

    I am writing a batch logon script for my windows 2000 server and windows 98 clients that will automatically copy a .lnk (shortcut) into the users startup directory. On my windows 2000/xp based systems this should be a simple task.

i.e.: copy \\server\cbldata\business\WPI529process.lnk C:\Documents and Settings\All Users\Start Menu\Programs\Startup


On the windows 98 systems the startup directory is located under the windows directory. Some of my systems windows directories are named differently. i.e. c:\win or c:\win98 or even c:\windows. I am kind of familiar with canonalization and I was wondering is there is a way that i could use a copy command similiar to the one above to perform this same proceedure in windows 98 regardless of what the windows directory is called.

i.e.: copy \\server\cbldata\business\WPI529process.lnk c:\%SYSTEM%\Start Menu\Programs\StartUp

Any insight is appreciated,

Question by:sadian
    LVL 95

    Accepted Solution

    Actually, I believe you're looking for the "%windir%" variable.

    copy \\server\cbldata\business\WPI529process.lnk c:\%windir%\Startm~1\Programs\StartUp
    LVL 2

    Author Comment

    YAY! your awesome!


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do email signature updates give you a headache?

    Constantly trying to correctly format email signatures? Spending all of your time at every user’s desk to make updates? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today!

    Update 11/3/2014 - Although the below article will get you to relocate the WINSXS folder, Microsoft has finally released a utility to reduce the size of the WINSXS folder. For some reason, it's not that straightforward. It only works on Windows 2008…
    Join Greg Farro and Ethan Banks from Packet Pushers ( and Greg Ross from Paessler ( for a discussion about smart network …
    The viewer will learn how to download, install and use CrashPlan from on Windows 7. Open your browser and go to Click get started, it’s free then Click the Download CrashPlan button: Click save in Internet Explorer, the…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    779 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

    11 Experts available now in Live!

    Get 1:1 Help Now