dmason72
asked on
Batch to del all files within a users folder in Win 8.1
Having trouble getting command to run and get "cannot find path specified".
Trying to delete specific files under user's folder (..."appdata\local\client folder") but not having any luck.
Files are under any user within specified AppData\local\client app folder.
I'd like to call the batch on login to clear out the folder whenever a user logs into windows if possible.
Thank you in advance!
Trying to delete specific files under user's folder (..."appdata\local\client folder") but not having any luck.
Files are under any user within specified AppData\local\client app folder.
I'd like to call the batch on login to clear out the folder whenever a user logs into windows if possible.
Thank you in advance!
Is this running as the user on logon through logon script or startup group etc?
DEL /Q /S "%USERPROFILE%\Local Settings\MyApp\*.*"
or DEL /Q /S "%USERPROFILE%\Local Settings\MyApp\*.whatever"
or to remove a dir:
rd /s /q "%USERPROFILE%\Local Settings\MyApp"
Steve
DEL /Q /S "%USERPROFILE%\Local Settings\MyApp\*.*"
or DEL /Q /S "%USERPROFILE%\Local Settings\MyApp\*.whatever"
or to remove a dir:
rd /s /q "%USERPROFILE%\Local Settings\MyApp"
Steve
ASKER
This will not work and thus the issue I'm having since the AppData folder varies with user profile name off of root therefore above path is not correct
(example "c:\users\%username%\AppDa ta\Local\C lient folder name\ where files being removed would be *.*).
How do I account for varying client app folder names (based on versions) and under different user profiles?
(example "c:\users\%username%\AppDa
How do I account for varying client app folder names (based on versions) and under different user profiles?
ASKER
Steve,
This is running as user on logon and are all files in that folder so:
DEL /Q /S "%USERPROFILE%\Local Settings\MyApp\*.*"
or DEL /Q /S "%USERPROFILE%\Local Settings\MyApp\*.whatever"
Dan
This is running as user on logon and are all files in that folder so:
DEL /Q /S "%USERPROFILE%\Local Settings\MyApp\*.*"
or DEL /Q /S "%USERPROFILE%\Local Settings\MyApp\*.whatever"
Dan
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Simple enough...used del /Q /S "%userprofile%\AppData\Loc al\client app folder version\*.*"
it deleted all files successfully once I confirmed path by entering it into cmd via start field.
Named file cleanmedia.bat so now I'm onto the next step to reference it in a new vb script and enter in AD scripts field per user.
Thanks everyone who took the time to put in their two cents and special thanks to Steve on this one for all the additional input.
Dan
it deleted all files successfully once I confirmed path by entering it into cmd via start field.
Named file cleanmedia.bat so now I'm onto the next step to reference it in a new vb script and enter in AD scripts field per user.
Thanks everyone who took the time to put in their two cents and special thanks to Steve on this one for all the additional input.
Dan
You can try one of them
del /p /s c:\AppData\local\client\yo
For /F "tokens=*" %%I in ('Dir c:\AppData\local\client\yo
del %FOUND%