ripken204 Posted September 9, 2005 Share Posted September 9, 2005 (edited) i basically would like to delete everything in the programs folder of the start menu, and au3 script for it would be nicei have been messing around but cant get it to work Edited September 9, 2005 by ripken204 Link to comment Share on other sites More sharing options...
Wiener Posted September 9, 2005 Share Posted September 9, 2005 (edited) Not quite sure exactly what you want to do but why not simply a batch file that deletes the objects?rd C:\Documents and Settings\Administrator\Start Menu\Programs /s /qthen simply recreate an empty Programs folder md C:\Documents and Settings\Administrator\Start Menu\ProgramsYou could do the same thing for All Users Programs folder.Ian Edited September 10, 2005 by Wiener Link to comment Share on other sites More sharing options...
ripken204 Posted September 10, 2005 Author Share Posted September 10, 2005 forgot to add that windows wont allow you to delete that folder. so i need some way of deleting the contents of the folder Link to comment Share on other sites More sharing options...
Wiener Posted September 10, 2005 Share Posted September 10, 2005 Strange, I just tried it and it worked here .... I first tried del C:\...\.* and like you mentioned got access denied. Then I tried the rd line and it worked just fine. Link to comment Share on other sites More sharing options...
ripken204 Posted September 10, 2005 Author Share Posted September 10, 2005 am i suppose to make it a cmd? b/c i did and nothing happened. Link to comment Share on other sites More sharing options...
rendrag Posted September 10, 2005 Share Posted September 10, 2005 even if you can't delete the folder, you could delete its contents, right?delete everything in here:C:\Documents and Settings\All Users\Start Menu\ProgramsandC:\Documents and Settings\<user>\Start Menu\Programs Link to comment Share on other sites More sharing options...
ripken204 Posted September 10, 2005 Author Share Posted September 10, 2005 i want to be able to do it silently tho Link to comment Share on other sites More sharing options...
seapagan Posted September 10, 2005 Share Posted September 10, 2005 i want to be able to do it silently tho<{POST_SNAPBACK}>If using a cmd script, just add '>NUL' at the end of each line (without quotes) to hide any output. Or use quick batch compiler in qhost mode.SP Link to comment Share on other sites More sharing options...
Wiener Posted September 10, 2005 Share Posted September 10, 2005 Use this and save as Whatever.cmd:@echo offrd "C:\Documents and Settings\Administrator\Start Menu\Programs" /s /qmd "C:\Documents and Settings\Administrator\Start Menu\Programs" Link to comment Share on other sites More sharing options...
ripken204 Posted September 10, 2005 Author Share Posted September 10, 2005 (edited) works perfectly, thxnow ide like to make this into an au3 scripthis is an example they give of how to use dosRunWait(@COMSPEC & " /c Dir C:\")i have no clue how to do it, ive tried this but no luckRunWait(@COMSPEC & " /c rd 'C:\Documents and Settings\All Users\Start Menu\Programs' /s /q")RunWait(@COMSPEC & " /c md 'C:\Documents and Settings\All Users\Start Menu\Programs' /s /q") Edited September 10, 2005 by ripken204 Link to comment Share on other sites More sharing options...
ripken204 Posted September 10, 2005 Author Share Posted September 10, 2005 tried this too but no luck, there are no errors coming up in au3, i have no clue why its not workingrunwait(@comspec & ' /c ' & 'rd "C:\Documents and Settings\All Users\Start Menu\Programs /s /q"')runwait(@comspec & ' /c ' & 'md "C:\Documents and Settings\All Users\Start Menu\Programs /s /q"') Link to comment Share on other sites More sharing options...
ripken204 Posted September 10, 2005 Author Share Posted September 10, 2005 well forget that then, im just gunna run the cmdau3 fileRunWait(@COMSPEC & " /c Start delStartMenu.cmd")Sleep(2000)Send("exit")Send("{ENTER}")DirCopy("Start Menu",@ProgramsDir,1)cmd file@echo offrd "C:\Documents and Settings\Administrator\Start Menu\Programs" /s /qmd "C:\Documents and Settings\Administrator\Start Menu\Programs"rd "C:\Documents and Settings\All Users\Start Menu\Programs" /s /qmd "C:\Documents and Settings\All Users\Start Menu\Programs"what this does is it deletes the start menu crap in the cmd file, then the last line of the au3 copies a folder to be the new start menu that is all organized how i like it, all for my UA Link to comment Share on other sites More sharing options...
InTheWayBoy Posted September 10, 2005 Share Posted September 10, 2005 Don't forget the Default User profile too...a couple of things hide in there..."Remote Assistance" comes to mind! Good luck! Link to comment Share on other sites More sharing options...
gunsmokingman Posted September 10, 2005 Share Posted September 10, 2005 (edited) Here is a nice simple VBS script that should do what you want.I have it set to just popup a message.This is for XP without ServicePack 2Red Text Are Popups that can be removed from the scriptGreen Text Remove The ' From Before The text to make active Example As Active Set objWMIService = GetObject("winmgmts: \\" & strComputer & "\root\cimv2") Set colFolders = objWMIService.ExecQuery("Select * from Win32_Directory where Name = '" & All_Up & "'") For Each objFolder in colFolders errResults = objFolder.Delete NextDim Act, Fso, All_Up,objWMIServiceSet Act = CreateObject("Wscript.shell")Set Fso = CreateObject("Scripting.FileSystemObject")All_UP = Act.ExpandEnvironmentStrings("%Allusersprofile%")strComputer = "."If Fso.FolderExists(All_Up) Then All_Up = Replace(All_Up, "\","\\")Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")Set colFolders = objWMIService.ExecQuery("Select * from Win32_Directory where Name = '" & All_Up & "'")For Each objFolder in colFolders ' errResults = objFolder.Delete Act.Popup "Confirm It Was Here" & vbCrLf & objFolder.name, 5, "Confirm", 0 + 32 NextElseAct.Popup "This Folder Is Missing", 5, "Error", 0 + 32End IfThis Is for XP with Service Pack 2 Installed, the above script will notwork on XP SP2. There was some changes to the WMI classThis script works I have left it with comments lines in it plus a testDim Act, Fso, All_Up,objWMIServiceSet Act = CreateObject("Wscript.shell")Set Fso = CreateObject("Scripting.FileSystemObject")All_UP = Act.ExpandEnvironmentStrings("%Allusersprofile%")strComputer = "."'If Fso.FolderExists(All_Up) Then '''' UNCOMMENT BEFORE USING NEED TO DELETE %Allusersprofile%'''' FOR TESTINGIf Not Fso.FolderExists("C:\Test1") Then '''' THIS LINE CAN BE REMOVED FOR TESTING ONLY Fso.CreateFolder("C:\Test1") '''' THIS LINE CAN BE REMOVED FOR TESTING ONLY Fso.CreateFolder("C:\Test1\Test2") '''' THIS LINE CAN BE REMOVED FOR TESTING ONLY Fso.CreateFolder("C:\Test1\Test3") '''' THIS LINE CAN BE REMOVED FOR TESTING ONLY Fso.CreateFolder("C:\Test1\Test4") '''' THIS LINE CAN BE REMOVED FOR TESTING ONLYEnd If '''' THIS LINE CAN BE REMOVED FOR TESTING ONLYIf Fso.FolderExists("C:\Test1") Then '''' THIS LINE CAN BE REMOVED FOR TESTING ONLYAll_UP = ("C:\Test1")'''' THIS LINE CAN BE REMOVED FOR TESTING ONLYDim arrFolders()intSize = 0Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")strFolderName = All_UpSet colSubfolders = objWMIService.ExecQuery("Associators of {Win32_Directory.Name='" & strFolderName & "'} " _ & "Where AssocClass = Win32_Subdirectory " _ & "ResultRole = PartComponent")ReDim Preserve arrFolders(intSize)arrFolders(intSize) = strFolderNameintSize = intSize + 1For Each objFolder in colSubfolders GetSubFolders strFolderNameNextSub GetSubFolders(strFolderName) Set colSubfolders2 = objWMIService.ExecQuery _ ("Associators of {Win32_Directory.Name='" & strFolderName & "'} " _ & "Where AssocClass = Win32_Subdirectory " _ & "ResultRole = PartComponent") For Each objFolder2 in colSubfolders2 strFolderName = objFolder2.Name ReDim Preserve arrFolders(intSize) arrFolders(intSize) = strFolderName intSize = intSize + 1 GetSubFolders strFolderName NextEnd SubFor i = Ubound(arrFolders) to 0 Step -1 strFolder = arrFolders(i) strFolder = Replace(strFolder, "\", "\\") Set colFolders = objWMIService.ExecQuery _ ("Select * from Win32_Directory where Name = '" & strFolder & "'") For Each objFolder in colFolders errResults = objFolder.Delete Act.Popup "Confirm It Was Here" & vbCrLf & objFolder.name, 5, "Confirm", 0 + 32 NextNextElseAct.Popup "This Folder Is Missing", 5, "Error", 0 + 32End If Edited September 10, 2005 by gunsmokingman Link to comment Share on other sites More sharing options...
Kelsenellenelvian Posted September 11, 2005 Share Posted September 11, 2005 You call that simple? Link to comment Share on other sites More sharing options...
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