• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 384
  • Last Modified:

using a script to delete a single file from multiple workstations

hi i am trying to delete a single file from multiple workstations. i figured this might be easier if i used a script. anyone have a script that can handle this ?
  • 2
1 Solution
Kyle AbrahamsSenior .Net DeveloperCommented:
as long is it's in the same path you can do this with 2 bat files:

bat file 1:  Named mydel.bat
del \\%1\C$\  < y.txt

bat file 2:
mydel workstation1
mydel workstation2

y.txt: - simple character "Y" to import the Yes for delete.

You could do this with a VB script if you just had a list of workstations already listed, but assuming your doing this from scratch.  

Kyle AbrahamsSenior .Net DeveloperCommented:
note you need to change the path of the del command.
If you run a logon script, and it's a basic batch file, you could add this command to do the delete:

e.g. to delete the file test.txt on the C:\ drive if it exists.....
IF EXIST c:\test.txt DEL c:\test.txt /F /Q

If your logon script uses a different scripting language, it must also be possible to run a similar command.

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.

Join & Write a Comment

Featured Post

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now