Jump to content

Batch help with Windows 7


Recommended Posts

Hi

I am running Windows 7 64bit

I am having problems creating a batch code to delete files in folders.

rd C:\Users\Brian\AppData\Local\Temp /s /q 
md C:\Users\Brian\AppData\Local\Temp

The code above works and removes the files, but I can't remove anything in this path below.

rd C:\Windows\Help\Help\en-US /s /q
md C:\Windows\Help\Help\en-US

Can anyone explain why it don't work.

I am creating a project to remove all the rubbish I don't use with windows, what I do when I reinstall windows I manually remove what I don't use so I want to create batch files to do it for me.

Link to comment
Share on other sites


  • 2 weeks later...

Hi

I am having problems here, I am trying to delete files and folders with windows 7 64bit

I have tried takeowner and also tried icacls

Can anyone help please i am getting messed up.

The code below is what i have tried + other attempts with no luck

[code@echo off

takeown /f C:\Windows\System32\en-US\winload.exe.mui

cacls C:\Windows\System32\en-US\winload.exe.mui /Brian:c

DelTree("C:\Windows\Help\Help\en-US", nil);Folder.DeleteTree("C:\Windows\Help\Help\en-US", nil);]

Edited by mecivic
Link to comment
Share on other sites

This is confusing me.

I changed the code around and still dont work.

Can anyone explaine what i am doing wrong.

@echo off

icalcs c:\windows\system32\en-us\winload.exe.mui /grant Brian:F

takeown /f C:\Windows\System32\en-US\winload.exe.mui

DelTree("C:\Windows\Help\Help\en-US", nil);Folder.DeleteTree("C:\Windows\Help\Help\en-US", nil);

I have also added a folder Testing-1 and Testing-2 inside like this

C:\Windows\Testing1\Testing2

and still cant figure it out to delete those.

Can someone explaine how to do it in Windows 7 64bit

Link to comment
Share on other sites

@echo off

icalcs c:\windows\system32\en-us\winload.exe.mui /grant Brian:F

takeown /f C:\Windows\System32\en-US\winload.exe.mui

DelTree("C:\Windows\Help\Help\en-US", nil);Folder.DeleteTree("C:\Windows\Help\Help\en-US", nil);

Not sure where you are coming up with Deltree or Folder.deltree, neither are valid in a command in a CMD/BAT script. To delete a folder and the tree under it:

rd /s /q <Root path>

so to get rid of en-us:

rd /s /q C:\windows\help\help\en-us

and your icalcs and takeown command are not taking ownership of the help folder. It is taking ownership of a single file, winload.exe which won't help you with deleting the help folder, you need to point it at the folder you are trying to delete.

Link to comment
Share on other sites

Sorry about this but still can't get it right

This is what i have now and still don't work.

@Echo Off

icalcs C:\Windows\Help\Help\en-US /grant Brian:F

takeown /f C:\Windows\Help\Help\en-US

rd /s /q C:\Windows\Help\Help\en-US

What i want to do is delete the en-US folder and it's contents inside.

The code above, is that correct.

Link to comment
Share on other sites

Thanks for your patience with me.

This is the code i have now.

takeown /r /f en-US
icacls en-US /grant Brian:F /t
rd /s /q C:\Windows\Help\Help\en-US

I have saved it as testing.bat

This is what it's coming up with

erroree.png

I have also added a folder to the same Help File as

C:\Windows\Help\Help\Delete

and used the code

takeown /r /f Delete
icacls Delete /grant Brian:F /t
rd /s /q C:\Windows\Help\Help\Delete

And the same error

Link to comment
Share on other sites

You can try like this:


@echo off
cmd /c TAKEOWN /F "%systemdrive%\Windows\Help\Help\fr-FR" /R /D O && ICACLS "%systemdrive%\Windows\Help\Help\fr-FR" /grant:r *S-1-5-32-544:F /T
rmdir /s /q "%systemdrive%\Windows\Help\Help\fr-FR"
exit

For english version:


@echo off
cmd /c TAKEOWN /F "%systemdrive%\Windows\Help\Help\en-US" /R /D Y && ICACLS "%systemdrive%\Windows\Help\Help\en-US" /grant:r *S-1-5-32-544:F /T
rmdir /s /q "%systemdrive%\Windows\Help\Help\en-US"
exit

Works fine for me!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...