DOS Batch File Help


Im trying to launch a bat file which clears out a few files from the users terminal server windows directory but Im not sure how to acheive this. Each time the user logs on, I want the batch file to run, I can get the file to run but I cannot get the syntax right to delete the file.

I tried this but its ignoring the %user% bit

del "c:\documents and settings\%user%\windows\start.ini"

Any ideas guys?

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.

change %user% to %username%

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
Steve KnightIT ConsultancyCommented:
If that is the user's profile directory too, you could use this in case something moves or is different for another user perhaps?


I suggest you do this as one of the users run as "showme.cmd" or whatever from a logon script or cmd.exe etc.

@Echo off

If one of the variables is showing nearer the correct path for your users then use that, otherwise try %userprofile% as above, then your hard coded path with %username% like LHT_ST suggested above.

daiwhyteAuthor Commented:
thank you
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
Microsoft DOS

From novice to tech pro — start learning today.