MgmTest Posted September 30, 2012 Share Posted September 30, 2012 my folder name is in () It can't delete the file inside of it.also if the file name is like Zircon-Just (alpha team remix).flp" or having + in it's name can't getting delete.+ChristophMaitland+Veela-Fall silently.flpFOR /D %%p IN ("%ProgramFiles(x86)%\Test\(CF3 Support)\*.*") DO rmdir "%%p" /s /qdel "%ProgramFiles%\Test\(CF3 Support)\Preset Sample Image.png" Link to comment Share on other sites More sharing options...
jaclaz Posted September 30, 2012 Share Posted September 30, 2012 my folder name is in () It can't delete the file inside of it.also if the file name is like Zircon-Just (alpha team remix).flp" or having + in it's name can't getting delete.+ChristophMaitland+Veela-Fall silently.flpFOR /D %%p IN ("%ProgramFiles(x86)%\Test\(CF3 Support)\*.*") DO rmdir "%%p" /s /qdel "%ProgramFiles%\Test\(CF3 Support)\Preset Sample Image.png"Which OS?Which Filesystem?It works here on XP/NTFS ( having set ProgramFiles(x86)=C: ) what is the output of SET ProgramFiles?@ECHO OFFSET ProgramFiles(x86)=C:SET ProgramECHO.DIR /S /B "%ProgramFiles(x86)%\Test\(CF3 Support)\"ECHO.FOR /D %%p IN ("%ProgramFiles(x86)%\Test\(CF3 Support)\*.*") DO rmdir "%%p" /s /qDIR /S /B "%ProgramFiles(x86)%\Test\(CF3 Support)\"C:\test>rmdirtest.cmdProgramFiles=C:\ProgrammiProgramFiles(x86)=C:C:\Test\(CF3 Support)\a folder with spaces (and + and - and brackets)C:\Test\(CF3 Support)\A_file.txtC:\Test\(CF3 Support)\a folder with spaces (and + and - and brackets)\+ChristophMaitland+Veela-Fall silently.flpC:\Test\(CF3 Support)\a folder with spaces (and + and - and brackets)\Zircon-Just (alpha team remix).flpC:\Test\(CF3 Support)\A_file.txtC:\test>jaclaz Link to comment Share on other sites More sharing options...
gunsmokingman Posted September 30, 2012 Share Posted September 30, 2012 I say it a permission issue, if you are using Vista and up. Try to right click the script and selectRun As Admin. Link to comment Share on other sites More sharing options...
MgmTest Posted September 30, 2012 Author Share Posted September 30, 2012 Thanks But x86 x64 windows 7. Link to comment Share on other sites More sharing options...
jaclaz Posted September 30, 2012 Share Posted September 30, 2012 (edited) Thanks But x86 x64 windows 7.I say it a permission issue, if you are using Vista and up. Try to right click the script and selectRun As Admin. In order to try and help people (actually coming here and asking for help) we often need to ask questions.You can easily spot them because they have a small "hook" sign "?" at the end.You were asked THREE of them:Which OS?Which Filesystem?what is the output of "SET ProgramFiles"?Right now we have a (vague) answer to only the first one, i.e. now we know that you are running Windows 7 (and probably the 64 bit version of it), and such a system WILL have issues with permissions IF the target is on a NTFS filesystem (question #2) AND it is run NOT with Administrator permission.Them someone may suggest you to try something, like:Try to right click the script and select Run As Admin.It would be nice if you could actually try the suggestion and report what happens. jaclaz Edited September 30, 2012 by jaclaz Link to comment Share on other sites More sharing options...
gunsmokingman Posted September 30, 2012 Share Posted September 30, 2012 Thanks But x86 x64 windows 7.I say it a permission issue, if you are using Vista and up. Try to right click the script and selectRun As Admin. In order to try and help people (actually coming here and asking for help) we often need to ask questions.You can easily spot them because they have a small "hook" sign "?" at the end.You were asked THREE of them:Which OS?Which Filesystem?what is the output of "SET ProgramFiles"?Right now we have a (vague) answer to only the first one, i.e. now we know that you are running Windows 7 (and probably the 64 bit version of it), and such a system WILL have issues with permissions IF the target is on a NTFS filesystem (question #2) AND it is run NOT with Administrator permission.Them someone may suggest you to try something, like:Try to right click the script and select Run As Admin.It would be nice if you could actually try the suggestion and report what happens. jaclazNow any body with half a brain wouldm of seen this, "%ProgramFiles% and that on Vista and up and if the UAC has not been disableit requires Admin rights to delete any folder or contents. Link to comment Share on other sites More sharing options...
MgmTest Posted October 2, 2012 Author Share Posted October 2, 2012 Hi I am using windows 7 x86 and also x64 with NTFS file system and also uac is disabled, but it doesn't work for me. also I want it to be compatible with vista and windows 8. thanks guys for your helps. Link to comment Share on other sites More sharing options...
jaclaz Posted October 2, 2012 Share Posted October 2, 2012 Hi I am using windows 7 x86 and also x64 with NTFS file system and also uac is disabled, but it doesn't work for me. Too bad. also I want it to be compatible with vista and windows 8.Good luck . thanks guys for your helps.Why? You evidently do not want to get help. jaclaz Link to comment Share on other sites More sharing options...
MgmTest Posted October 2, 2012 Author Share Posted October 2, 2012 haha you are funny but being funny is not answer to may question.as I mentioned before this is my problem: my folder name is in () It can't delete the file inside of it.also if the file name is like Zircon-Just (alpha team remix).flp" or having + in it's name can't getting delete.the script you gave me doesn't work fine on all version of windows I look for something which is working fine and smooth on all version of windows. Link to comment Share on other sites More sharing options...
jaclaz Posted October 2, 2012 Share Posted October 2, 2012 haha you are funny but being funny is not answer to may question.EXACTLY like your posts are NOT the anwers to the questions I asked, but are merely a re-post.So we are perfectly even , you don't answer to the questions I ask, and I do not provide an answer to your question/problem, the difference being that everything works for me , while it doesn't for you .jaclaz Link to comment Share on other sites More sharing options...
gunsmokingman Posted October 2, 2012 Share Posted October 2, 2012 1:\ Are you trying to remove %ProgramFiles(x86)%\Test\(CF3 Support)\ and all it sub folders and files?2:\ Or are you trying to remove from %ProgramFiles(x86)%\Test\(CF3 Support)\ all the files and leave the folder empty?Here is a VBS script that I tested to remove a folder in the Programfiles Test Path = C:\Program Files (x86)\Test-(Delete) MeRemove FolderHow I ran it on Win 7 x64 UAC enable1:\ Open Cmd Promt with admin right2:\ CD to script location EG CD C:\Users\Gunsmokingman\Desktop3:\ Type this in Cmd Promt Window Wscript Test_Delete_ProgramFiles.vbsVBS ScriptDim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")Dim Loc :Loc = "C:\Program Files (x86)\Test-(Delete) Me" If Fso.FolderExists(Loc) Then Fso.DeleteFolder(Loc),True List Files In ProgramFiles FolderHow I ran it on Win 7 x64 UAC enable1:\ Open Cmd Promt with admin right2:\ CD to script location EG CD C:\Users\Gunsmokingman\Desktop3:\ Type this in Cmd Promt Window Cscript Test_Delete_ProgramFiles.vbsthis will show all the files in the parent directory in the Cmd Promt windowVBS ScriptDim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")Dim Loc :Loc = "C:\Program Files (x86)\Test-(Delete) Me"' If Fso.FolderExists(Loc) Then Fso.DeleteFolder(Loc),True Dim Obj For Each Obj In Fso.GetFolder(Loc).Files WScript.Echo Obj 'Fso.DeleteFile(Obj),True Next 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