Over 1 million tech questions and answers.

How do I write a batch file for all files in a folder?

Q: How do I write a batch file for all files in a folder?

Hi all,

I need to execute the Windows command:

metaflac --dont-use-padding --remove --block-type="PADDING" Filename.flac

For every file in a folder, including every file in the subfolders! (Two levels of subfolders.) The file name extension is as mentioned above .flac.

I understand a batch file is the best way to accomplish this, but what should it contain?

Many thanks!

Preferred Solution: How do I write a batch file for all files in a folder?

I recommend downloading and running Reimage. It's a computer repair tool that has been proven to identify and fix many Windows problems with a high level of success.

I've used it in the past to identify and fix everything from blue screens (BSOD's), ActiveX errors, corrupt files and processes, dll/exe/sys errors, recover lost memory, Windows update problems, defragging, malware removal etc.

You can download it direct from this link http://downloadreimage.com/download.php. (This link will automatically start a download of Reimage that you can save to your computer.)

A: How do I write a batch file for all files in a folder?

Read other 6 answers

Was infected by the matsnu1 virus recently which encrypes and locks all your data files. Got all my files back by running matsnu1decryp.exe You need an original clean file before the virus struck for it to work out how to decrypt all your other files does does save the day. Down side is that you end up with two files. The the original and a locked version. You can just go through your hard drive and delete the locked files but I have a 1TB disk with thousands of files and folders. Since all the locked files begin with "locked" I was wondering about some sort of batch file that would do this for all folders and sub folders. I am sure I remember doing this stuff years ago with DOS but don't remember enough to try it. Grateful if anyone could let me know the DOS command for this or some other way of quickly deleting many files which have part of the name which is common to all files. They all have different extensions so cannot use that option. My drive is H:


A:How do I write batch file to delete thousands of files

At this time there is a lot of tutorials to do *Batch files. I recommend looking at Batch File Help and Batch File Commands to try to do do this. But to delete thousands of files, you can just go to your computer security (such as NOD32 Antivirus) and clean the hard drive of the files. It worked for me when I last had that blasted virus (which was a while back). If you still have problems, contact me again and I'll try to help.

Read other 6 answers

Wanted to see if any one here wouldn't mind writing a batch file or script that would move multiple files to a target folder. Here are the specifics:
HDD1 Contains Folders A,B,C,etc...
Folder A contains Folder A1 which contains File A2
Folder B contains Folder B1 which contains File B2
Folder C contains Folder C1 which contains File C2
Folder D contains Folder D1 which contains File D2
Folder E contains Folder E1 which contains File E2
Folder F contains Folder F1 which contains File F2

And what I need to do is move A2,B2,...F2.. to the drive root.

This would really save some time over moving these files manually, because they're numerous.
Or if you know of any utilities that can do this, please let me know

A:Batch file for moving files to folder?

I am assuming that these all folders are in X drive

such that your file A2.xxx is in X:\Folder A\Folder A1

move "X:\Folder A\Folder A1\File A2.xxx" X:\
move "X:\Folder B\Folder B1\File B2.xxx" X:\
move "X:\Folder C\Folder C1\File C2.xxx" X:\
move "X:\Folder D\Folder D1\File D2.xxx" X:\
move "X:\Folder E\Folder E1\File E2.xxx" X:\
move "X:\Folder F\Folder F1\File F2.xxx" X:\

save it as bat file.
If you are using windows 7 than open the file in Administrator mode.

I hope it will help

Read other 9 answers

Does anyone know of a way to do this...

I have a bunch of files under a main folder... call it.. "FolderX".. under folderX are sub folders.. say... "Folder1" "Folder2" etc.. under those folders are "Folder1B" "Folder1C" etc...

I want to move files out of those subfolders and into the root of folderX..

I'm guessing a vbs script could be written but i'm not sure on this?

Anyone have any examples of how to do this?


Read other answers

I just downloaded all of the Google Web Fonts and they were each downloaded into their respected folders, so instead of clicking on folder after folder and right clicking after right clicking and finally installing each and every font;

How can I create a command prompt (batch) file so the prompt can search the main folder where all the font folders are, grab any and all TrueType Font files and move or copy them into another single folder?

A:Custom batch file that copies font files to another folder?

It seems like it would be easier to search by the TTF file extension.

Copy the results where you want them.

Read other 3 answers

My files have a format of "ID_date_time.d7d?
Ex: 11111-5_2013_10_07_142149.d7d
The ID is 1111-5 and was tested 10/7/2013 at 2:21:49 PM and the file extension is always .d7d

The local files are automatically saved here by the program generating the data:

I want them copied to the following directory:
E:\common\UserGroup\UserLocation\Test Data\(ID)
For the above example, it would be copied to: E:\common\UserGroup\UserLocation\Test Data\11111-5

Then, upon successful completion of copying the file, I want the file moved to:
C:\IDArchive\Data\Old Data

Then the file should be removed from the original Local folder.

I can do most of this with a batch file, up to the point where I match the file in the Local\Data folder to its proper destination using its ID number. I need to pull the ID number out of the file name and use it to identify its destination - all of the destination folders already exist. I can't figure out the correct code in the batch file to find the ID number and then extract and match it to its folder.


A:Move files from original folder to existing folders - w batch file?

Hi Jordansl,

Here's a full solution to the task you mention. A double For /F loop is used to extract this ID from each file name.


@echo off

REM For each file in %source_location%, copy it to
REM %copy_to%\*ItsID*, then move the file to %move_to%.

set from_source="C:\Local\Data"
set copy_to="C:\common\UserGroup\UserLocation\Test Data"
set move_to="C:\IDArchive\Data\Old Data"

pushd "%from_source:"=%"
for /f "delims=" %%A in (' dir /a:-d /b %from_source:"=% ') do (
for /f "tokens=1 delims=_" %%B in ( "%%~nxA" ) do (
for %%C in (%COPY_TO%) do (
if exist "%%~fC\%%~B"\* (
copy "%%~fA" "%%~fC\%%~B"
) else (
echo.& echo A destination directory for the file '%%~fA' does not exist.
echo Would you like one to be created for it with the file '%%~nxA' copied to it?
echo If N, the file will not be copied or moved.
choice & if not errorlevel 2 md "%%~fC\%%~B" && copy "%%~fA" "%%~fC\%%~B"
if not errorlevel 2 move "%%~fA" "%MOVE_TO:"=%" || echo.

Read other 1 answers

0 down vote favorite
I want to run a batch file that would delete files in a folder (and its sub folders) that are older then 30 days. I'm somewhat new to scripting so any help would be appreciated. The path to the folder is "C:\Documents and Settings\user profile\Application Data\Program\Program\folder\company name" That folder has many random sub folders - I need the batch file to delete any file in those subfolders older then 30 days.
Is this something that can be done with a batch file or would I need a higher level script - like vb scripting?

A:batch file to delete files in a folder and sub folders older than 30 days

Looks like Endoro has you covered on SO. He is very good at what he does. He is using FORFILES which is the perfect utility for this.

Read other 1 answers

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...

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 folder\video.mp4 -f mp3 -ab 160000 -vn "\different folder\music.mp3"

what I would like to do is add to this so that I don't have to write out this code for every file I have... :/

I have the mp4 files in one folder and than the mp3 files are saving to another folder.

So here's an example of what the code will do if it isn't clear yet.

Folder 1:


what it should do is grab video1.mp4 and convert it.

ffmpeg -i folder\video1.mp4 -f mp3 -ab 160000 -vn "\different folder\music1.mp3"

and than move onto the next one

ffmpeg -i folder\video2.mp4 -f mp3 -ab 160000 -vn "\different folder\music2.mp3"

and than the next one

ffmpeg -i folder\video3.mp4 -f mp3 -ab 160000 -vn "\different folder\music3.mp3"

It's going to have to grab the name from the mp4 file and insert it for the mp3 file.

I can get around pretty good in cmd if it's basic commands but when it comes to something like this I'm a little confused...

Thanks for the help in advance!
I'll see what i can do about searching some more on what I would have to do and if I find the solution I'll post it here if it isn't already answered.

A:Batch File that grabs file names from folder to insert into batch file

A DOS "for /f" loop should do the trick, although changing the filename extension for the output to do everything in one line escapes me at the moment.

Perhaps you could do a dir .\folder\*.mp4/s/b > mp4s.txt, then make a copy of that and edit each line to rename the file to the destination name, and save it as mp3s.txt. Then you just feed both the source (mp4s.txt) and destination (mp3s.txt) filesnames into the for /f loop which handles the ffmpeg conversion.

Quite a crude solution and you'd have to handpatch the destination filenames, but i can't think of how to get a source mp4 filename and then just change the extension.

Read other 3 answers

I am a complete newbie when it comes to batch files and batch file software, so apologies in advance.

I've done some research on Google etc but I seem to just be getting more and more confused trying to use various different scripts and programs and reading different info on various websites.

This is what I need...

I have a folder with around 2000 files in it. I want to be able to copy certain files from this folder (normally around 40) and place them in a brand new folder, I want to be able to do this with nothing more than a txt file that has all the file names I need copying in it with every file name on a separate line.

I receive around 10 new txt files each day so you can imagine how tedious it is searching through 2000 files, picking out the 40 I need, 10 times a day everyday.

To make things even more complicated, the txt files I receive don't always have the correct file names in them, maybe there's a misspelling or a word or two missing for some of the names. That's ok when I'm going through picking out the files I need to copy myself because I can normally tell which file is being requested, but I can't see it being so easy for a program or whatever to do, I'm guessing it'll need to have a search feature where it picks out the most likely file.

I'd like it to be as automated as possible. I receive the txt file, make sure each file name is on a separate line then a program or script or whatever goes out and picks out the files (or most likely files f... Read more

A:search multiple files, copy+paste to new folder (batch file software?)

Contact Rent-A-Coder, Elance, or any of the other programming for hire sites. They could knock this out pretty quickly I would think.

Read other 5 answers

Hey, I need to know how to write a batch file that can set my secondary display as the primary one and then launch a program in it. Is this even possible.
Or is there a program that can I can run through batch to switch the screen first.

A:Write a batch file

I have written enough batch in the last couple of years and I don't believe this would be possible with a batch file.

Don't have any other suggestions for you at this time.

Read other 1 answers

I need to write a batch file or vb script that will take the following share names (which are stored in a .csv Excel file) and then run the following command:

NET USE \\[entry from 1.csv file]

The object is to have this command establish a NET USE connection to each share name from the 1.csv file.
These are the first five entries from the 1.csv file:

Can you please write a command script that will do this for me? My OS is Windows XP Service Pack 2.
Contact me with any further questions.
[email protected]

Read other answers

I wrote this batch file which does what I want it to do so far.

@echo off

"C:\Program Files (x86)\VideoLANold\VLC\vlc.exe"

VLC is a video program so I want to associate video files to this bat file. This would mean that when i clicked on a video file in Windows Explorer, the bat file would execute and VLC would open the file I double clicked. At the moment the only thing that happens in this setup is that the bat file executes like normal but no video is played.

Is this possible, and if so how can I accomplish it?

A:How can I write a batch file that opens a file in a program?

Have you tried associating the video files to open with VLC by default ?
Maybe you don't need a BAT file ?

Default Programs - Associate a File Type or Protocol

Read other 9 answers

Hey guys,
Im trying to write a batch file that will allow me to backup one of my HDDs in my PC. Im running vista, and i have 2 internal HDDs. One is C: which has the OS and all programs installed on it, and the second internal HDD has all my other gear (music, photos, videos, illustrator files, CAD files, etc).

I recently purchased a 500GB external HDD and have been backing up using vistas utility, but i dont like the way it archives all the data into .zip/.rar files and such. I would like to maintain the directory structure from my internal HDD, and back it up to the external. Another thing is...ive created 2 partitions on my external HDD (one for the PC backup - NTFS - about 300GB, and the other to use as extra storage for my PS3 - FAT32 - about 150GB). I used Paragon Partition Manager to do this and apparently that was a success.

So ive written a batch file as follows:


xcopy /e /d /v /y F: H:\BackUp\F



which i got from this site http://www.ahuka.com/backup/backup3.html

i tested the batch file on a single smalled folder from my F: and it worked well. But when i tried to backup my entire F:, which is about 250GB, it runs through the command cycle and appears to complete correctly, but when i look on my Hexternal) there are no files or anything, and 50GB has been used (rather than an expected 250GB)

is there a problem with the batch file? or an issue with the way i have partitione... Read more

A:Can someone please help me write a batch file to backup my PC?


I tried this once with an external drive plugged into my server, i had about 55gb of MP3's to copy over as a backup.

I wrote a similar batch file to yours and scheduled a task to run it.

It didnt work and only copied a small portion of the files.

Last night i tried backing up 55gb of files from one external drive to another using the standard cut and paste procedure, it kept failing, i figured that the external USB drives just couldnt cope with such a large data shift all at once.

I then did cut and paste on sections of the files until all copied over OK.


Do your copying in blocks of 20GB using cut and paste. I know its slower and not what you want.

Maybe someone on here can suggest if its the USB side of things that is causing the problem.


Read other 7 answers

Hello all. I'm trying to write a request to COM2 and capture the answer. My device is 19200 baud 8/1 non parity.

Using a freeware terminal called termite I can send the hex instruction and receive the answer, as verified in HHD serial monitor.

My batch file looks like this:

MODE COM2: baud=19200 parity=N data=8 stop=1 to=off
TYPE request.txt>COM2
COPY COM2 text.txt
where request.txt contains my request.

HHD sees the request being written, but the device does not respond.

Any ideas please?


A:Serial read/write in batch file?

Are you aware this is a Windows 7 forum?

Read other 9 answers

I do a lot of internet troubleshooting and would like to put a simple batch file in customers computers that will let me see their DNS numbers when they are using a router.
I currently do this from a command prompt for Comast:

set type=ns

It's been years since I wrote a batch file and so I just put these lines in notepad and labeled it dns.bat

However, this just runs the first line, nslookup.
Is there a command that will cause each line to run after Windows has performed the line above?

Or, is there an easier way to do what I want to do?

Thanks in advance!

A:I want to write a batch file to get the DNS numbers behind a router.

NSLookup itself pulls up the first server IP of the two servers I have listed.
Would it not be easier to simply open Network and Sharing Center, click Change Adapter Settings, right click on the Local Area Connection and select Properties, select IPv4, click properties?
Note I am using servers I manually entered in.

Read other 9 answers

I'm interested in learning how to write batch files, does anyone
here know of a good site that teaches that? thanks....

A:know of a good site for learning how to write batch files?

I responded to your duplicate thread in Dos forum.


Read other 1 answers

Hello all , i am new to batch programming.

I wish to have a batch file to read .apk file from folder and then copy it to another folder. Then it should rename the copied apk file to test.apk

i have a file in folder e:\apps\angrybirds.apk , I want to copy this angrybirds.apk to d:\apps and rename it to test.apk

Here the file names in the e:\apps\ will be changing. So what ever may be the name , it should read the name of the file from e:\apps\ folder , copy it to d:\apps\ and rename it to "test.apk" . Test.apk is a fixed rename

A:Solved: Batch file to copy a file from folder and rename it in another folder

Read other 12 answers

I need my Windows 8 computer to stay on duplicate display all day long by default. It keeps reverting to extend. I'm a teacher and I'm showing powerpoints and pdfs all day long and it is annoying to hit the alt F8 key all day long to switch back to duplicate. Any simple solution? I can't find one.

Looking around it looks like at batch file could be written to make duplicate stay as the default... problem is I've never written an batch file but would like to if someone could walk me through it. It looks like the batch file needs to include: DisplaySwitch.exe /clone

I'm not sure how to write the batch file or where to save it to once it is written.

Any help to my problem would be appreciated.

Read other answers

Hi All,

Can any1 help me on writing a batch file for Windows XP which will amend the following registry key:

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\SafeMode\Components\DeskHtmlVersion

I have never written a batch file before, however I have had a try and it doesn't work. The details of my file are below:

REM -----Fix Active Desktop-----
Windows Registry Editor Version 5.00
regedit.exe /s "%USERPROFILE%\Desktop\Keith.reg"
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components]

I need to change the value data in the key from Decimal 272 to 0.


A:Solved: How to write a batch file to amend a registry key??

Read other 16 answers

Basically i'm trying to write something that can auto download combofix/malwarebytes and anything else like that on a weekly basis to keep the files up to date in a directory for the techs at the place I work.  We do a-lot of antivirus removal and if we could get these updated weekly and placed on our NAS box that would be so helpful rather than manually doing it (which really does not take any time but as a tech we like to automate things).  Any recommendations would be so helpful.Edit: Moved topic from All Other Applications to the more appropriate forum. ~ Animal

A:How can I write a batch file with wget or something that DL's combofix weekly

Subject of ComboFix downloading is covered here: http://www.bleepingcomputer.com/forums/t/462410/combofix-auto-downloader/For the other applications those will have to be addressed individuallyAlso another topic with wget and ComboFix:http://www.bleepingcomputer.com/forums/t/356979/ftpwget-download-combofix/

Read other 3 answers

Hello all,
I've recently moved my media hard drive to an external for greater portability. I've noticed that whenever I restart my machine or cycle the power on the external all the drives are set to a Write Protection mode.
I've set the security settings to give all users administrative access, but it still sets it to readonly.
I've restorted to using the CMD to remove the protection manually, but I'm looking for something more permanent or simple.  I've little to no experience with Batch files, but my old room mate used them extensively and the idea came to mind of using
one to reset the readonly status of the partitions.  
I use the list of commands in CMD here
Then I repeat this for partitions 4-7.  
If anyone knows a permanent solution or can show me the script/commands to type for a batch file I'd be very thankful.

A:Win7 Write Protection removal for external hard drive and batch files



You could run the command to unlock the external hard drivers. The commands are correct. When running the batch file, please right click it and run as administrator.


Regarding the Write Protection issue, please check if there is any jumper which is located next to or near the cable connector port to set write-protect mode. Also,
check the BIOS setting and see if the following method could fix the issue.


In Device Manager, right click external hard drive, Update Driver Software, clicked on the Browse, in the List option, and chose the "Standard Dual Channel PCI IDE


More helpful information



Note: Since the website is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.


Best Regards,

Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

Read other 3 answers

Dear All,

I need to create a batch file which can read the size of file(e.g. 1kb, 2kb...etc) from specific folder and detect 0kb file and convert it to text file (showing 0kb file size) with alarm.

I am not really sure how to write command for this batch file. Please help :-(

A:How to create a batch file to read size of file on specific folder path

Read other 10 answers

Hi all,
I need help to create windows batch file for following requirements.
1. Remove .txt and .log file format in sub folders.
2. Zip individual file inside any sub folders and give file name through command prompt. 
3. Create sub folder zip file include file zip

Read other answers

I am trying to write a batch program the list the current directory files that end in *.dwg
into a file on my C drive.
I have used the following code:
dir *.dwg /b >C:FileListing.txt
start notepad C:FileListing.txt

This code only gives file names in the current directory.
I need to have a list of path and file names in the file FileListing.txt
Is there a way to do that without including subdirectories??

Thank you,

A:Solved: Batch file to list file names in current Folder.

Read other 9 answers

I want a batch to select and open a random link file in a folder i have. All the links are music videos I like to listen to, and I kind of want to just have an option for 'surprise me!'.
I can change the file names if I have to, and I have a basic batch file ability. I know the simple commands, but nothing of the variables, signs-involving commands (&%!?), etc.

Also, I want to learn a whole lot more about programming/java/batch file, so it'd be awesome if any code could be explained. Thank you, in advance

A:I need a batch file to open a random file within a certain folder/path

There's a free Windows scripting language called Autoit3 that would do this task easily using these functons:


AutoIt - AutoItScript
It has a Basic like syntax and is easy to learn.

Another popular scripting for Windows is AutoHotkey
AutoHotkey: macro and automation Windows scripting language

The syntax can be confusing but it has object support and is more powerful.

Of course there are tons of others for Windows:

Here's a list. The details for each tell which OS are supported:
Free Programming Languages - Freebyte's Guide to

Read other 5 answers

I have a computer that is a drone specifically for an outside LED sign. This computer is designed to never shut off and doesn't have any other program on it besides Operating System and the sign software. I need to create a batch file that I can place in the "start-up" folder that will open the program (LEDStudio10) and open the file that I want to play. I have already tried multiple attempts and I was hoping someone out there in sevenforums world would be able to point me in the right direction.

A:batch file open file for program in the startup folder

Task Scheduler. Create a new/basic task. You can invoke your batch script there. This can occur after boot completes, after user logon, etc. You can set it to run daily weekly hourly, etc. You can even have it delay X (preseleted time amounts) minutes/hours after boot/logon if you want.

Task Scheduler - Create New Task

Read other 1 answers

I am unable to write/modify/replace files in the Program Files or Program Files (x86) folders, we have folder that is placed in Program Files folder, lets say MES folder
we use Active Directory System and all user take file from FTP server if there's Program's Update from System that I make, so new file/files will replace old file/files in MES folder, it was work smoothly in Windows 7 Pro, but not in Windows 8.1 Pro
the things I already do was :
1. Change User Account Control Settings to Never Notify (lowest)
2. Turn Off Windows Firewall setting (Domain, Network Location, Public Network)
3. Change advanced security add local user for Full control, modify, read and execute (to take ownership and grant full control permission of the folder and all contents in it)
I Know from forum it must be about user security issue but this 3 steps still not change anything
How can I defeat this?

Many thanks.
Michael H.

Read other answers

hi all.!!

Actually, I want to help my elder cousin brother this time. He has been given a task to create a new folder and copy about 1600 photographs from a folder that contains about 3700 photographs. He has a list of the file names that he need to copy in a separate *.txt file.

He can do it manually by opening the main photograph folder searching for the filename and then copying that to a separate folder. But that would take a lot of time and efforts. I was wondering there must be a better way to do it.

It would be better if a command could copy the file name from the Text file, searches for it in the main photograph folder and when it founds the file matching the name then copies that file to a separate folder.

Is there any cmd command (Windows 10) or a Linux Bash command to do the job instead of doing it manually. If anyone knows a better way to do this then please do mention it as it will save a lot of time and efforts.

Thanks in advance.

Please excuse my English, as it is not my first language, I guess I was able to explain the problem. However, if any more detail is needed please do let me know.

Read other answers


I recently suffered an SSD failure, but luckily i was able to recover the files using @active's boot disk. The issue is that the files i recovered require that their file names be long, @active saves them as short file names due to DOS limitations, and creates a batch file that i can run to return them to their previous (long) name.

The issue is i have over 500 folders, and this will take a very long time.

Is there away to run all batch files in a folder (including subfolders) or is there a way to run all batch files with a certain name? (they are all named !_RENAME.bat).
Any tips or ideas would be appreciated!

A:Run all batch files that exist within a folder?

See the /R switch in For command for command prompt

Microsoft Corporation

The way to get them all would be to put the folders all underneath one folder. Like C:\MyBatches or something.. if they are not already under one root folder. Open a command prompt in drive C: then do
cd \MyBatches
for /R %s in (*.bat) do %s

Edit: Also you can look in the .bat. If it is a simple command to change to long filenames you can do it directly. But since the bats are already there... I would sample a few and make sure there's nothing that looks dangerous like del *.* or anything suspicious.

Read other 1 answers

Hi all, i am trying to get a simple batch file to find the path to a certain file, which may vary, but the file name remains the same inside different folders.. would this be possible using batch or would there be a way to do it using a different method?

Also would it be possible to take the path to this file and set it as a variable for use in a DIFFERENT batch file, i have setx in system32 to set a new environment variable if i can get the filepath to be set from there..

anyone needs any more information please ask but any help would be appreciated.

A:Search for file/folder using batch

Probably need to full description of what you want to do - maybe a batch file is not the best answer.

For simple example, you could try a batch file containing the command

DIR C:\%1 /s > pathout.txt

Then %1 is a variable, so you would use the batch file as : findfile name_of_a_file where you substitue the name of the file you are searching for each time you use the batch file. The DIR command lists all the files of that name (and wild card could be used just as easily), with the /S switch causing a recursive search through subdirectories, starting at C:\ The redirection parameter causes the ourput of the DIR command to be output to a text file called pathout.txt.

If you examine pathout.txt it contains a set of paths and files found in the format

Directory of C:\mydocu~1\personal

PERSONAL.DOC 36234 28/07/2008 10:59

where (because this is a surviving Dos program), the pathname is stated in the old Dos 8.3 layout. You see what I mean by 'not the best answer' ? Then the path(s) could be extracted by, for example, a simple basic program which in turn could actually build, or create the actual paths for use in a different batch file.

There are umpteen freeware programs from the days of yore capable of doing the same thing as DIR in a million different ways, but sticking to just Windows XP, the Dir command works as described, the ATTRIB command (found in c:\windows\system32) can do much the same thing but outputs full path names without s... Read more

Read other 2 answers

I have a program called defprint on C:\

I want to create a batch file that I can put in the All Users startup folder to run the defprint program when any user logs in.

What is the coding in the batch file to go with this line so that it will automatically run the program in the background.

C:\defprint /d IP_10.11.9.2



A:batch file in startup folder

I think all you need to do is create a shortcut to the program. On the shortcut > Properties > Target line, you can add the switch:

/d IP_10.11.9.2


so that it reads:

C:\defprint /d IP_10.11.9.2

Put the modified shortcut in the All Users Startup folder.

Anyway, this question probably would be answered best in the "Development" forum where the experienced coders are more likely to be found.

Read other 3 answers

I would like to create a batch file to delete a specific folder. The folder is PGP Corporation. When I try to execute del PGP Corportion it is really trying to delete a folder called PGP. It isn't seeing that PGP Corportation is the entire file name because of the space. Do you know what I need? Thanks for your help!

A:Batch file to delete folder

Values with embedded spaces need to be quoted. Also, you can't just use the del or erase command for directories. You need to use the rmdir (remove directory) command.

Like this:

rmdir /s /q "C:\PGP Corporation"

Read other 8 answers

Hi, I'm wondering,
is there a way I can encrypt a folder with a batch file,
then decrypt it using a password only I know?
or is there another command line tool that would allow me to do this?

Read other answers

I am unable to copy files to the Program Files or Program Files (x86) folders, despite my status as Administrator on a single-user system. As an advanced user, I have many legitimate needs to place files there and cannot live with this level of protection
from myself.
How can I defeat this? Many thanks.

Rick A.
Pleasanton CA

A:Can't Write to Program Files folder

Mark, that worked -- thanks a million, as I would never have found that little needle in the Windows 8 haystack. I do not in any way consider this to be progress or evolution in OS design...

Read other 41 answers

I've got a corrupted file in my CD write folder that I have tried to delete every way I can think of...without success. So every time I log on to the computer a message pops up that says I have files that are ready to be written to a CD. The file and the folder it is contained in are also part of every CD write job I set up since they always in the CD write folder.

Does anyone know how to purge corrupted file from the CD write folder? Not a major problem, but after several months, it is driving me nuts.


A:Undeletable file in CD write folder

Read other 9 answers


My temporary folder has been have batch files created in it every 15 seconds or so. My mouse is the arrow with the busy circle at 2'oclock of it constantly, so something is running. I checked my processes and they seemed to all be normal. I updated everything including windows.net 4 so I don't know what else to try :| Any help or ideas would be greatly appreciated, thanks!

Edit: it is Windows 7 64bit Home
i3 Processor w/ 4gb ram
And the batch files all have been 6 digits numbers increasing in numbers so it would be like 178521 and the next one would be 178762 etc.

Edit edit: There are two conhost.exe running, don't know if that has anything to do with the issue

A:Temp folder getting filled with batch files

Start Task Manager. Click Processes Tab. Make sure the check box at the bottom that says "show processes from all users" is checked. Post a screen shot.

Windows 7 Forums - FAQ: Reading and Posting Messages

Read other 6 answers

I need to create batch that will look in a folder that contains a 1000+ files and need it to highlight or do something so i can be able to distgunish which key words from the file actually exist in the folder, the files that exist are based on key words "the key words are numbers", each file in the folder contains these keywords and on each file name the key words are indexed at 0-3 from left to right, so its the first four characters. and i have them saved in a txt one per line

A:Finding numerous files in a folder using a batch

It sounds like a homework assignment.

I'm not sure I get the bit about the filename numbering. But if you need to search the contents of the files for words I would try some Windows version of Grep. There are free ones out there for download.

Read other 1 answers

Hello Guys,

I need to create a batch file which renames a folder from one name to a date in the format of YYYYMMDD. I see where you can do it on a file but for the life of me I can't find out how to do it for a folder using the REN command. Any suggestions would be helpful.

Thanks in advance...

A:Batch File Help (Renaming a folder to a date)

AFAIK ren works the same on folders as on files. have you tried it?

Read other 1 answers

Hi, I don't know if I am posting this in the right place but here is my problem:

I want to create a batch file that will load all the video files in a folder without opening them. I think this is possible and other people have done it for image files from what I've read online (loading the icons in a folder). I can scroll through and load each file individually but takes too long to do each time. If someone is familiar with righting batch scrypt then I would think how to do this would have a simple answer. I tried something suggested in another forum on a different website but it didn't work. They had the command:

@echo off
explorer C:\FolderName\SubfolderName

This opened the folder location but didn't load all of content. I would still have to manually scroll through and load everything.

If Someone knows how to do this and can tell me exactly what to type in (what command/scrypt) for the batch file that would be perfect!


Read other answers

Hi, I don't know if I am posting this in the right place but here is my problem:

I want to create a batch file that will load all the video files in a folder without opening them. I think this is possible and other people have done it for image files from what I've read online (loading the icons in a folder). I can scroll through and load each file individually but takes too long to do each time. If someone is familiar with righting batch scrypt then I would think how to do this would have a simple answer. I tried something suggested in another forum on a different website but it didn't work. They had the command:

@echo off
explorer C:\FolderName\SubfolderName

This opened the folder location but didn't load all of content. I would still have to manually scroll through and load everything.

If Someone knows how to do this and can tell me exactly what to type in (what command/scrypt) for the batch file that would be perfect!


A:Batch File to Load Icons in Folder

Hmm.. Where are you trying to load them ?

If you're talking about loading video files to a player, most players have an option of a Media library/playlist, just point it to the folder and the app will auto scan and load all the video files in a given folder.

Read other 4 answers

hello, is it possible to have a batch file make a shared folder?

A:batch file make a shared folder?

Welcome to TSG!

Shared as in Shared on the network, or just shared with other users on the same PC?
Both are possible.
MD - Make Directory
Cacls - set NTFS permissions
Net Share - create network share

For more info, type these commands:
MD /?
Cacls /?
Net Share /?

Read other 2 answers


I have a batch file which should delete everything under specified folder. the batch file ask the user to specified the folder which then be stored against %vmpath% variable. The following script is deleting every thing including the specified folder but i do not want to delete the specified folder. Sorry i am very new to batch scripting, require some help please.

IF Exist "%vmpath%\EMS96.exe" RD /S "%vmpath%\*"

thank you

A:Delete Folder Content with Batch file

Easiest to just recreate the folder after deleting it:

If Exist "%vmpath%" RD /S /Q "%vmpath%"
MD "%vmpath%
You don't need to specify a file name, unless you only want to delete the tree if that file exists.

If the parent folder can't be deleted and then recreated, you need a For loop to get the subfolder names.

PushD "%vmpath%"
Del /Q /F *.*
For /F "Tokens=1 Delims=" %%I In ('Dir /AD /B') Do RD /Q /S "%%I"

I've added a bit more in the following. This first switches to the folder specified on line 2, so the path entered must be relative to that folder. This is to prevent someone from typing C:\Windows and deleting the entire Windows tree. Do Not use C:\, or they can type Windows and delete the Windows tree.
If this will be used by multiple users, and the folders to be deleted are in there profile, you can use the %Userprofile% variable so it will be specific to the current user.

@Echo Off
PushD C:\Test Dir1
Set /P vmpath=Please enter the Parent Folder name relative to %CD%:
If /I "%vmpath%"=="exit" PopD&Goto :EOF
If NOT EXIST "%CD%\%vmpath%" Echo Unable to locate "%CD%\%vmpath%". Please check spelling.&Goto _Ask
Echo All Files and folders contained in %CD%\%vmpath% Will be Deleted!
Set /P _Confirm=Are you sure? (Y/N):
If /I "%_Confirm%"=="N" Goto :_Ask
If /I NOT "%_Confirm%"=="Y" E... Read more

Read other 2 answers


I found an usefull batch on this thread:


My problem is that it only works with files, it doesn t take in account sub-folders.

I would need the batch to archive each files and first subfolder encountered in separate archive on the given folder (that's what the gui usually do when you do it manually).

Thanks for you help!

Read other answers

I'm trying to write a batch file that when run creates a folder named "Backup" followed by the time it was created, and then copies files to that folder.

When I run

md "C:\Users\MasterControlProgram\Documents\MC Server With Backup\Backups\Backup %DATE%\"
xcopy /e /v /y "C:\Users\MasterControlProgram\Documents\MC Server With Backup\Server\world" "C:\Users\MasterControlProgram\Documents\MC Server With Backup\Backups\Backup %DATE%\"

It creates a folder named the date it was created and places the folders in it. How do I make it so the folder is named the time instead of the date?

A:Batch file to create a folder with name of the time.

you could do something like the below.
*disclaimer*: I am a fairly decent UNIX shell script programmer, but I suck at Windows programming. I did NOT test this out, but it should give you the general idea.

set SOURCEFOLDER="C:\Master"


Read other 2 answers

So here is my problem, once I download a file I run this script:

filebot -script fn:amc --output "E:/Completed" --log-file amc.log --action copy --conflict override -non-strict --def subtitles=en artwork=y "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D"

After this script has ran, it retrieves information, renames the file and moves this file/s to a folder. However, it leaves the initial folder/file (The original) behind, instead of being deleted. I'ts quite frustrating... since I did not know how to tweak the script to do that, I figured I needed to use a batch file to remove the original folder, however the batch file I have written only deletes files not folders. So, when the batch file runs (Automatically everyday via Task Scheduler) it asks (Are you sure? Y/N?)

Is there a way I can tweak the original script to delete this original folder/file that had been downloaded after it has done it's thing? If not, is there any way to remove the folder via the batch file I wrote?

This is the batch file:
forfiles -p "E:\Completed" -s -m *.* /D -0 /C "cmd /c del @path"

Any help would be greatly appreciated. Thank you.

Read other answers

I have been trying to create a shortcut to launch a batch file one folder up from the shortcut location.
I have been able to do this using and intermediate batch file in the same folder as the shortcut as follows:
@echo off
FOR %%V IN ("%~dp0..\") DO set curdrv=%%~dpV
start "" %curdrv%Oneup.bat

And the shortcut target is:
%windir%\system32\cmd.exe /c Intermediate.bat

and the 'Start in' is left blank.

This way I can move these folders anywhere on the drive or another drive and the shortcut still works.
However, I would like to leave out the Intermediate.bat file and launch the Oneup.bat directly. I tried:
%windir%\system32\cmd.exe /c FOR %%V IN ("%~dp0..\") DO set curdrv=%%~dpV && start "" %curdrv%Oneup.bat
in the Target of the shortcut, but it doesn't work.
Is there some trick to getting this to work?

Read other answers