# Solved: .bat to delete files from all users



## Davecann2 (Feb 9, 2012)

Hi All,

I am woking hard to create a simple batch file that will delete a files from all user profiles within Win 7 remotely. Maybe this example will clerify better...


```
DEL [URL="file://\\server\c$\Users\%ALLUSERSPROFILE%\AppData\Roaming\IsolatedStorage\StrongName.g1btotwacmgxh35anhz5tuqk20pyno0a\AssemFiles\EmailContactData\*.xml"]\\server\c$\Users\%ALLUSERSPROFILE%\AppData\Roaming\IsolatedStorage\StrongName.g1btotwacmgxh35anhz5tuqk20pyno0a\AssemFiles\EmailContactData\*.xml[/URL]
```
...As you can see my code is incorrect. I believe the isses is wih the %ALLUSERSPROFILE% Can anyone provide ang suggestions that mau point me in the right direction?

Thnaks!!!


----------



## Squashman (Apr 4, 2003)

Were you not able to accomplish this in your thread from 10 months ago?
http://forums.techguy.org/dos-other/1040227-solved-batch-file-issues.html


----------



## foxidrive (Oct 20, 2012)

This might work: enter the server or IP list in the serverlist.txt file.


```
@echo off
for /f "delims=" %%z in (serverlist.txt) do (
pushd "\\%%z\c$\users"
for /f "delims=" %%a in ('dir /ad /b') do (
echo processing user "%%a" on server "%%z"
DEL "%%a\AppData\Roaming\IsolatedStorage\StrongName.g1btotwacmgxh35anhz5tuqk20pyno0a\AssemFiles\EmailContactData\*.xml" 2>nul
)
popd
)
```


----------

