finding the windows directory in batch script


    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,

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lee W, MVPTechnology and Business Process AdvisorCommented:
Actually, I believe you're looking for the "%windir%" variable.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sadianAuthor Commented:
YAY! your awesome!

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.