Batch processing is the execution of a set of commands or software programs without user intervention. A batch file is a text file containing a sequence of such commands or programs invocations.

learn more… | top users | synonyms

57
votes
8answers
146k views

Can you zip a file from the command prompt using ONLY Windows' built-in capability to zip files?

I have a batch file that outputs a text file. I thought it would be nice if I could zip it up too. This will be used in an uncontrolled environment, so I can't make assumptions about the presence of ...
51
votes
12answers
25k views

How to supress “Terminate batch job (Y/N)” confirmation?

In cmd, when we press Ctrl+C we get the target application terminated but if the target application is called from a batch file, we get this "Terminate batch job (Y/N)" confirmation. I can never ...
49
votes
6answers
58k views

Batch converting PNG to JPG in linux

Does anyone know a good way to batch-convert a bunch of PNGs into JPGs in linux? (I'm using Ubuntu). A png2jpg binary that I could just drop into a shell script would be ideal.
46
votes
8answers
94k views

How to run a batch file without launching a “command window”?

On Windows XP, can I run a batch (.bat or .cmd) file, via a shortcut, without a "black window"?
30
votes
2answers
20k views

How does the Windows RENAME command interpret wildcards?

How does the Windows RENAME (REN) command interpret wildcards? The built in HELP facility is of no help - it doesn't address wildcards at all. The Microsoft technet XP online help isn't much better. ...
28
votes
14answers
107k views

Run a completly hidden batch file

I'm looking for some way to run a batch file (.bat) without anything visible to the user (no window, no taskbar name, .etc..). I don't want to use some program to do that, I'm looking for something ...
24
votes
6answers
168k views

How do I make a batch file wait / sleep for some seconds?

I use a batch file to start up a few of the programs I need running in the background. Up until now, I had used the pause command to execute it after some of the other start-ups finished. I would ...
23
votes
7answers
55k views

How to make the PC speaker beep from the Windows 7 command prompt?

I'm running some lengthy video encodes using the Handbrake command line interface. After all my encodes are done, I would like to have the PC speaker beep, as I usually turn my large external speakers ...
22
votes
7answers
37k views

How to auto detect text file encoding?

There are many plain text files which were encoded in variant charsets. I want to convert them all to UTF-8, but before running iconv, I need to know its original encoding. Most browsers have an ...
22
votes
1answer
16k views

Is there an equivalent to /dev/null in Windows?

If I want to ignore stdout of a command, I do this on *nix: myprog > /dev/null How do I achieve the same on Windows (in cmd or a batch file)?
21
votes
10answers
17k views

Renaming many files in Mac OS X, batch processing

I used to rename file in Linux via a rename command: rename 's/old_pattern/new_pattern/g' *glob Is there something similar in Mac OS X (Snow Leopard)?
21
votes
8answers
42k views

How do I create a Windows Batch file that does not show the Command Prompt when executed?

I have installed a ruby gem called Redcar, which is launched from the command line. When it runs, it steals the shell until it terminates, so I have to create a new shell window to continue doing ...
20
votes
9answers
47k views

How to prevent the command prompt from closing after execution?

My problem is that in Windows, there are command line windows that close immediately after execution. To solve this, I want the default behavior to be that the window is kept open. Normally, this ...
19
votes
2answers
35k views

How to check the exit code of the last command in batch file?

Inside a batch file on Windows, I use 7-zip like this: ...\right_path\7z a output_file_name.zip file_to_be_compressed How could I check the exit code of 7z and take the appropriate action ?
19
votes
6answers
86k views

Running bat file at startup as administrator in Windows 7

I'm currently running a startup script in form of a bat file successfully in Windows 7 (I've inserted a new registry key entry with the bat file path as value in ...
18
votes
9answers
30k views

Can a mapped network drive be reconnected from the command line?

On a daily basis I find myself in the Windows command prompt needing to access a network drive that is mapped but disconnected. I have yet to find a command that will reconnect this drive without ...
18
votes
11answers
15k views

How do I batch change the date taken information in EXIF data?

I use F-Spot to manage my images. For one set of images, the dates somehow got messed up and they all are marked as September 1st 2007. I'd like to change the date taken information to a different ...
16
votes
7answers
48k views

Get current folder name by a DOS command?

Is it possible to get the current folder name (not current directory path) by using a DOS command? If so, how? The closest I got was this but it doesn't do it: for /f "delims=\" %%a in ("%CD%") do ...
16
votes
5answers
32k views

Using Gimp to batch convert images to another format in Windows

As implied by the title, does anybody know how to use the gimp-console-[version].exe program to batch convert images between formats (with default settings) in Windows ?
16
votes
5answers
30k views

Variables in batch file not being set when inside IF?

I have two examples of very simple batch files: Assigning a value to a variable: @echo off set FOO=1 echo FOO: %FOO% pause echo on Which, as expected, results in: FOO: 1 Press any key to ...
15
votes
2answers
7k views

VIM: What is the EX-mode for batch processing for?

The tutorial mentions that the Ex-mode is for batch processing. Since it is a nuisance, rather than a tool, for me, I would like to see some practical examples. Who uses it? Why? What is the EX-mode ...
14
votes
9answers
50k views

Populating Array in DOS Batch Script

How can I setup an array variable in a DOS batch script? I would like to load it with a list of file names to process. I really would like to keep this as simple as possible. Thank you.
12
votes
4answers
8k views

How to delete files from a folder using a list of file names in windows?

i have a folder with 2K+ files in it, i need to delete around 200, i have a txt file with all the file names i need removed ordered in a list, how do i remove the specific files from the folder using ...
12
votes
4answers
12k views

How to batch combine JPEG's from folders into PDF's

I have a about 500 folders with images inside. Is there a way I could batch convert this so that I get .pdf files that contain all images inside as pages? EDIT: There should be 500 PDF's created, ...
10
votes
8answers
5k views

How to run commands as in a queue

I need to do a lot of copying of various files to various folders. I can add all my copy commands to a bash script and then run that, but then I must wait until it finishes if I want to add more ...
10
votes
7answers
4k views

Determine if command is recognized in a batch file

I'm writing a bat script in which I invoke a program (such as javac). For simplicity, I want to check if the command exists before I run it. i.e. If the command exists in PATH. For example, if ...
10
votes
3answers
6k views

Can I use the “start” command with spaces in the path?

I have a path like this: Y:\xxx\dd sss\aaa\ccc Y:\ is mapped to an FTP address. Now when I try to use start to open my folder I cannot. Command prompt makes mistake and goes to Y:\xxx\dd folder! I ...
10
votes
2answers
6k views

Run a batch/cmd upon screensaver

Is there a way to run a .bat or .cmd when the screensaver starts? I've noticed some .exe can run if you rename them to .scr but is that it?
9
votes
8answers
33k views

Why won't cmd exit after execution of batch file?

Why won't cmd exit after execution of batch file? I have tried: "C:\Program Files (x86)\Java\jre6\bin\javaw.exe" -Xmx1024M -Xms1024M -jar Jilko.jar and @echo off "C:\Program Files ...
9
votes
6answers
5k views

How to send a batch file by email

Trying to send a batch file as an email attachment, I get the following error: mx.google.com rejected your message to the following e-mail addresses: foo@googlemail.com mx.google.com ...
9
votes
2answers
53k views

Batch file that runs cmd.exe, a command, and then stays open at prompt

I would like to make a batch file that: Opens cmd.exe Within that Command Prompt runs net use to display mapped share paths Leaves the window open so that I can run additional commands if I wish to ...
8
votes
2answers
689 views

How do I make a batch file be able to run on other computers

When I create a batch file on my computer to execute start c:\Users\________\Whatever\..., it works on my machine. How can I get it to work on someone else's machine, since their username isn't my ...
8
votes
3answers
13k views

Windows script to copy some text to the clipboard?

I am using an application that requires several attempts to log in (because of overloaded servers). This app has no "remember my password" feature. Therefore, I would like to make a script ...
8
votes
2answers
20k views

Batch convert multiple PDF to Image on Mac

What would be the quickest way to convert a bunch of pdf files to jpeg files? I know I can open Preview and Save As image, but that could take a long time.
8
votes
2answers
6k views

Programatically associate file extensions with application on Windows

I've just recently reinstalled Windows and in setting up my environment I've noticed that all my associations for the various programming languages I edit in Notepad++ have gone (naturally). I am ...
8
votes
1answer
8k views

Run a batch command for every file in a directory

I have a Java program working with this syntax: command.jar namefile I have to run this program for 1600 files in a directory. How can I run this command for every file automatically? Is there a ...
8
votes
1answer
6k views

does %* in batch file mean all command line arguments?

does %* in batch file mean all command line arguments?
8
votes
6answers
22k views

Enable/disable wireless interface in a bat file

Is there a way to enable/disable a wireless network interface via the command line (so I can put it in a bat file)? When I'm in the office I use a wired connection, but Windows still occasionally ...
8
votes
2answers
5k views

Windows CMD Batch, START and output redirection

I would like to run two programs simultaneously from a batch file, and redirect the first program's output into a text file like: start python 1st.py arg1 arg2 > out.txt start 2nd.exe %1 arg2 arg3 ...
8
votes
3answers
4k views

Is there any way to get the windows cmd shell to expand wildcard paths?

Occasionally, the cmd shell's inability to expand wildcard paths can really be an inconvenience. I had to pass 100 files in a directory to a program, and couldn't type *.ext. Instead, I used mingw's ...
7
votes
8answers
12k views

Do something every 10 seconds batch file

I have a batch file: arp -s 192.168.1.254 xx-xx-xx-xx-xx-xx ipconfig /flushdns How can I do these two commands on Windows XP, every 10 seconds?
7
votes
8answers
17k views

How to make 7-zip do a whole bunch of folders

I got a bunch of pictures that I had to crop into 800x600 pixels. That was easily done, but now I have to upload them so the family can see them all. Thing is, this is 500MB in pictures. I decided to ...
7
votes
2answers
664 views

Weird characters (´╗┐) at the start of a batch file

I am working with batch files in Windows, using both Notepad, and Notepad++. When I run the batch files, which all start with @echo off, I see the first line (when running on two separate machines) ...
7
votes
4answers
13k views

Batch file for Windows7 32 and 64 bits

I need to build a batch file for Windows 7. This .bat file is just for installing an application. The issue is that I need to know if Windows 7 is 32 bits (and then run a 32 installer) or if it is a ...
7
votes
3answers
837 views

Quickest way to reduce ~400 images to .05% of original size

I have around 400 images that are taken from a 8 megapixel camera. I want to reduce the image size to around 4k pixels. What is the fastest way to do this, I have access to both windows and linux ...
7
votes
5answers
2k views

Is there a Windows equivalent of the script command in Linux? [duplicate]

I have gnuwin32 and SFU. Neither has the script.exe command. Does anyone know if there is the script.exe equivalent for Windows, other than from Cygwin, which I do not want to install (for reasons ...
7
votes
3answers
3k views

How to disable the output of 7-Zip?

I use 7-Zip to compress files inside a batch file like this: ...\right_path\7z a output_file_name.zip file_to_be_compressed I got the following output: 7-Zip 4.65 Copyright (c) 1999-2009 Igor ...
7
votes
3answers
4k views

Batch remove comments from PDF files

How can I easily remove all comments and annotations (added with Foxit Reader) from all the PDFs in a folder?
7
votes
3answers
6k views

How can I automatically log out users from a Windows machine?

I would like to make sure that people are logged out once they're done working on a single, specific multi-user machine. Currently, the next user will just "switch user" and keep working, but having ...
7
votes
2answers
922 views

Generate or update a PDF to include an encrypted, hidden watermark?

Background Using LaTeX to write a book. When a user purchases the book, the PDF will be generated automatically. Problem The PDF should have a watermark that includes the person's name and contact ...