kukris Posted August 9, 2006 Posted August 9, 2006 The following commands won't workdir %userprofile%\recent\*.*del %userprofile%\recent\*.*The following error is displayedThe system cannot find the path specified.However when I usecd %userprofile%\recentit changes to my profile folder and in the subfolder recent where I can use the DEL commandMy profile doesn't contain any special characters, just a dot in the profile name.Has someone a solution for this?
Mr Snrub Posted August 9, 2006 Posted August 9, 2006 Use quotes:dir "%userprofile%\recent"del "%userprofile%\recent\*.*"%userprofile% contains spaces ("C:\Documents and Settings\username"), so you need to delimit the path with quotes for dir & del to work.
Yzöwl Posted August 9, 2006 Posted August 9, 2006 just to add to the above, the CD command does not treat spaces as delimiters and therefore doesn't require the quotes.
gunsmokingman Posted August 9, 2006 Posted August 9, 2006 Here is a VBS script that will delete all the files in RecentSave As DeleteRecent.VbsDim Act : Set Act = CreateObject("Wscript.shell") Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject") Dim User : User = Act.ExpandEnvironmentStrings("%userProfile%\recent\") Dim Folder : Set Folder = Fso.GetFolder(User) Dim Files : Set Files = Folder.Files Dim objFile For Each objFile in Files Fso.DeleteFile(objFile.Path), True Next Act.Popup "Completed Script",5,"Finished",0 + 32 + 0
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now