| 1. |
Solve : Batch File- Delete Files (Folder Name is a Variable)? |
|
Answer» So to make this as simple as possible... So to make this as simple as possible... Simple is good, but the post is a little short on specifics. It would have been nice to know the registry key. You can use the reg query utility to extract the directory name from the registry and then use the del command with a wildcard. Something like his may help: Code: [Select]echo off for /f "skip=2 tokens=3" %%i in ('reg query HKLM\system\currentcontrolset\services\tcpip\parameters /v databasepath') do echo del %%i\* The registry key is the path found in the left pane of the regedit program. The /v switch value is the name field found in the right pane of the regedit program. The value returned by the for statement is the data field in the right pane of the regedit program. The code snippet contains an echo instruction to prevent any deletions until you are satisfied the returned directory is valid. Remove when you are ready. The snippet can be modified to delete the files (attachments) individually in case you need to keep some based on name or date or whatever. Good luck. |
|