
How do I delete a folder using a script, how easy is it please as i am not a script expert.
Thanks
Z
http://www.tutorial-web.com/asp/fso/...roperty=Delete
http://www.devx.com/vb2themax/Tip/18643
vbscript btw
also what exactly are you trying to do
Type in on a command line DEL /? and RMDIR /?
Or AutoITs DirRemove.
Code:; Delete C:\Test1 and all subdirs and files DirRemove("C:\Test1", 1)

Hi
I am trying to remove things from the start menu that are not need.
@mattx thanks for that, is that a VBS or BAT script please?
Thanks
The script is an auto it script , the commands he posted before that are from command line.
Depends what you want to do, I mean you could put the command line commands into a bat file.
Code from JScript5.chm and Vbscrip5.chmCode://JScript var fso; fso = new ActiveXObject("Scripting.FileSystemObject"); fso.DeleteFolder("C:\\foldername"); 'VBScript Dim fso Set fso = CreateObject("Scripting.FileSystemObject") fso.DeleteFolder("C:\\foldername")
Edit: Sorry guys, vbscript uses one slash and JScript uses two slashes. JScript uses two slashes as the first slash is used to denote an escaped character such as \n \r \t etc where as vbscript use vbCr vbLf vbTab and so on.
Bit of a daft question but I have always seem some code snippets in delete or copy files or folders with one slash ie \ and others with 2 ie \\Originally Posted by arran
such as this :
[quote="arran"][code]//JScript
var fso;
fso = new ActiveXObject("Scripting.FileSystemObject");
fso.DeleteFolder("C:\\foldername");
'VBScript
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFolder("C:\\foldername") '<-- in the directory path there is \\
Just wanted to know what difference does it make ?
There's a freeware prog called orphan remover that scans the start menu for dead shortcuts and removes them. It can be ran in a quiet mode from a script.
Where I used to work for had student accounts set up not to process the all users profile instead all the shortcuts came from the students mandatory profile. We then had orphan remove set to kill the shortcuts for any progs that weren't installed on that particular machine.
Have a look on the microsoft scripting site. There a plenty of snippets on there you can play around with and put together to make your own scripts. If you look under the sticky in the scripting section you will also see a few programs that will create basic scripts for you.

Thanks guys i ended up using this
Z'VBScript
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFolder("C:\\foldername")

Using this code
When the folder does not exist i get the following message, any ideas please?'VBScript
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFolder("C:\\Documents and Settings\All Users\Start Menu\Programs\folder1")
fso.DeleteFolder("C:\\Documents and Settings\All Users\Start Menu\Programs\folder t2")
Last edited by FN-GM; 25th June 2008 at 02:47 PM.

stickat the start of your script, that will ignore any errors thay occur when it runs.Code:On Error Resume Next
Mike.
Thats the easy way but the correct way would be to check if the folder exists then try and delete it else do nothing.Originally Posted by maniac
I suspect that the problem is with the double back slash in the VBS.
I don't recall having to use it in leteral path references.
Now JScript with its nod to its Java/Unix roots uses // because a single forward slash in a quoted string normally introduces control characters.

You are indeed correct! (but I'm always one for the easy option.)Originally Posted by ChrisH
My VBS coding skills are limited!
Mike.
There are currently 1 users browsing this thread. (0 members and 1 guests)