• RSS
  • Twitter
  • FaceBook

Security Forums

Log in

FAQ | Usergroups | Profile | Register | RSS | Posting Guidelines | Recent Posts

deleting folder with VBS\batch file

Users browsing this topic:0 Security Fans, 0 Stealth Security Fans
Registered Security Fans: None
Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Programming and More

View previous topic :: View next topic  
Author Message
Battousai
Spammer
Spammer


Joined: 27 Jul 2004
Posts: 0
Location: Doncaster, UK

Offline

PostPosted: Thu Nov 18, 2010 1:33 pm    Post subject: deleting folder with VBS\batch file Reply with quote

i need a script to delete a folder from the local drive when a user logs onto the domain (windows 7 client).

the two ways i've been looking at are:-

Batch:-
@echo off
rmdir /s /q "C:\Users\%username%\Documents"

but as far as i can tell rmdir will not delete a folder if it has anything in the folder

VBS:-
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFolder("c:\users\teststudent\documents\")

but the problem with the VBS script is i would need every username in the domain to be listed as %username% doesn't work (as far as i know) in VB...

can anyone help me out?
Back to top
View user's profile Send private message Visit poster's website
krugger
SF Mod
SF Mod


Joined: 08 Jun 2006
Posts: 16777209


Offline

PostPosted: Fri Nov 19, 2010 5:39 pm    Post subject: Reply with quote

rmdir /s /q DIR

Should delete the directory and all files in it without prompting.
At least that is what the help says:
rmdir /?
Back to top
View user's profile Send private message
Display posts from previous:   

Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Programming and More All times are GMT + 2 Hours
Page 1 of 1


 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Looking for more Windows Networking info?

Sign up to the WindowsNetworking.com Monthly Newsletter, written by Enterprise Security MVP Deb Shinder, containing news, the hottest tips, Networking links of the month and much more. Subscribe today and don't miss a thing!
View a sample newsletter.

Become a WindowsNetworking.com member!

Discuss your Windows Networking issues with thousands of other Windows Newtorking experts. Click here to join!

Community Area

Log in | Register

Readers' Choice

Which is your preferred data recovery solution?

Follow TechGenix on Twitter