Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: batch file text help

08 Sep 2015   #1

windows 7 32 bit o/s
batch file text help

I am trying to create a task using a batch file which i can then add to my windows task manager so that i can schedule it run every 7 days.

I need the file to delet anything which is contained within the scanned documents folder. The folder is located on a network and shared by other users.

The code that i have so far is

set "folder=\\IVNKING\Shared Files\Scanned Documents"
pushd "%folder%"
for /d %%i in ('*') do rmdir "%%i" /q

Does anybody know if this will delete only the contents of the scanned documents folder or if it will delete anything in other folders in the path.

My System SpecsSystem Spec
09 Sep 2015   #2

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan

Hi Jodie,

Because there are single quotes placed around that asterisk of your For loop, the For loop will find nothing to loop on. The single quotes aren't meant to be there.

Once you've fixed the For loop (by removing those single quotes), I can tell you what the batch file does: it will delete all non-hidden, empty-only folders under "\\IVNKING\Shared Files\Scanned Documents", and will not touch any files.

Quote   Quote: Originally Posted by Jodie959 View Post
I need the file to delete anything which is contained within the scanned documents folder.
Below is a batch file that will do just that.
set "folder=\\IVNKING\Shared Files\Scanned Documents"
pushd "%folder%" || exit /b
del * /f /q
for /f "delims=" %%I in ('dir /a:d /b') do rd "%%~I" /s /q
My System SpecsSystem Spec

 batch file text help

Thread Tools

Similar help and support threads
Thread Forum
Batch File .bat to copy file from File Sharing & FTP Hosting
Hi all, Any idea how to write Batch File .bat to copy file from File Sharing & FTP Hosting to local directory. Current the File Sharing & FTP Hosting is SMARTFILE. I don't want to use WINSCP as the connector. Thanks
General Discussion
Seeking Pic/image merge (w/text or small img) batch application
I don't know if what I have in mind exists or not. I am hoping the following description is enough to determine - is this possible and if it currently exists in any related application. Essentially, what I need to do is place/position a couple/several lines of text in a region (upper left, upper...
How to run a batch file at logoff & some batch scripting help please
Hiya, I'd just like to run a simple batch file at logoff to backup some settings. I plan to use Robocopy, which is what i use to more thorough backups. Two questions: 1. How make it run by clicking Start > Shutdown? (i realise i could make a shutdown batch file and run it instead, but i'd...
Backup and Restore
Batch File that grabs file names from folder to insert into batch file
Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can... :confused: First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg. Here's the code that I'm using: ffmpeg -i...
General Discussion
How to create a batch file that will move files based on the file type
How to create a batch file that will move files based on the file type? My Requirement : I need a batch file to copy all .doc files in all my HardDisk to a removable disk say (Z: drive) . Can anyone make it possible using a batch file?Please...Its urgent...
General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 15:45.
Twitter Facebook