![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| Guest | Delete File VBS Hi Guys, Quite a simple one, I need to delete a file from our users computers, I want to use a VBS script which I will run at logon. If file does not exist the VBS script should not run and if it does it should be deleted. It needs to be silent as well. Cheers |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: Delete File VBS On Aug 22, 7:58 am, grumbleno...@xxxxxx wrote: Quote: > Hi Guys, > > Quite a simple one, I need to delete a file from our users computers, > I want to use a VBS script which I will run at logon. If file does > not exist the VBS script should not run and if it does it should be > deleted. It needs to be silent as well. > > Cheers on error resume next sFileSpec = "C:\somefolder\somewhere\somefile.ext" DeleteAFile(sFileSpec) Sub DeleteAFile(filespec) Dim fso Set fso = CreateObject("Scripting.FileSystemObject") If (fso.FileExists(filespec)) Then fso.DeleteFile(filespec) End Sub WSH 5.6 documentation download (URL all one line) http://www.microsoft.com/downloads/d...displaylang=en Tom Lavedas =========== http://members.cox.net/tglbatch/wsh/ |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Delete File VBS Thank you Tom. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| cannot delete a file due to error that file is open | Vista file management | |||
| cannot delete old DOS file | Vista file management | |||
| cannot delete mail in delete file | Vista mail | |||
| Create New folder, move file, delete file. Explorer Freeze | General Discussion | |||
| Re: YOU CANT DELETE A FILE? | Vista General | |||