Need help to delete/copy files using .bat file for windows 2003 logon

By asizemore ·
I have a file that needs to be uploaded onto each workstation when a user logs in. Are there commands that can be placed into the logon batch file for this? I need to delete a file from the hard drive, then copy a file from a network drive to the hard drive. I tried some simple DOS commands (del,copy) but those give me access denied when I try to use them.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

those are the commands

by lowlands In reply to Need help to delete/copy ...

but it will depend on how and when you the batch file.
Does the batch file run as the user that is logged on to the workstation? If so, make sure the user has the permissions needed to delete the local file and also has at least read permissions to the network location.
If the script runs as the computer account, verify the same things for that account.
Also, make sure to use the right parameters in your batch file to ensure it is not waiting for user input. Something like <b>del /Q</b>

Collapse -

Thanks for your help...

by asizemore In reply to those are the commands

Thank you for your assistance. I'm not sure about the permissions. I do know I want to add it to the .bat file that runs when the person logs onto the computer. If I try to delete the file myself through windows explorer I can delete it, but when I try to run under the .bat file I get access denied. Where would I check/change the permissions? Sorry, it is probably a simple thing, but this is a new server and am trying to get what we lost a month ago back (we had a command similar in our Windows 2000 server .bat file). But I can't access that file to find what the command was.

Collapse -

Nevermind! Xcopy works

by asizemore In reply to those are the commands

Nevermind my other message. I found the xcopy command in Microsoft pages and that works. Thanks for helping though...you kept me pointed in right direction!

Collapse -

ROBOCOPY can work too

by cody In reply to Nevermind! Xcopy works

ROBOCOPY can work as well. It has a lot more advanced switches so you can get it to do copy only if the file is different from it's source for example.

It's a Microsoft tool as well.

Related Discussions

Related Forums