Text file containing a sequence of commands or program invocations that does not need user intervention.

learn more… | top users | synonyms (1)

14
votes
4answers
34k views

Remove USB device from command line

I'm constructing a backup script for Windows 7, and the last action I want it to perform is to safely "remove" the USB drive that it is backing up to. I am under the impression that plugging the drive ...
33
votes
2answers
29k 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. ...
5
votes
3answers
1k views

CMD - Why “start winword” works but just “winword” doesn't

Assume Microsoft Office is installed. Consider the following batch file: REM the following line successfully launches Microsoft Word start winword REM none of the following commands work to launch ...
1
vote
2answers
6k views

Running bat file using Windows scheduler

I wanted to run a .bat file in Windows task scheduler, so I opened it, added a new task, browsed to the bat file, and... nothing happened. So I changed the timing to see if it'll run, and it didn't. ...
1
vote
2answers
625 views

How do I make a batch file the default application for a file type

I am trying to associate .svg files with a batch file that runs squiggle from batik. When I right click on an svg and select Open With and Choose Default Program, I get the usual window, which lists ...
5
votes
5answers
14k views

How to replace a single character in Windows filenames using a batch file?

I have a Windows Server 2003 server that has a whole bunch of filenames that need renaming. Basically, I just need all - (hyphens) replaced with _ (underscores), no matter where they are in the ...
3
votes
2answers
1k views

Automatically accept Windows Logo testing?

I am trying to upgrade a printer driver remotely and have prepared a batch file for this. The only problem is that when I'm installing the drivers I get a popup in which I need to press "Continue ...
2
votes
1answer
12k views

Pass a path with space to a batch file as a parameter

In first.bat, I use var5=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\ CALL scripts\vc64.bat %var5% And in scripts\vc64.bat, I use SET var6=%1vcvarsx86_amd64.bat CALL ...
50
votes
9answers
114k 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"?
10
votes
1answer
11k views

How can I permanently append an entry into the system's PATH variable, via command line?

What I need to do: Append a folder to the %PATH% environment variable at the SYSTEM level. Make the change permanent. How I need to do it: Using the command prompt, or another method by which ...
7
votes
3answers
3k views

How to extract a complete list of extension types within a directory?

Within a directory, and recursively within it's sub-directories, meaning every directory within a directory is processed, how do I compile a complete list of unique extensions within the directory? ...
1
vote
8answers
8k views

How do I rename a bunch of files in the Command Prompt?

I have a problem with filenames. The stupid camera I am using resets the autonumber sequence every so often, and therefore I am getting tons of conflicts if I try and put lots of photos in a single ...
4
votes
4answers
24k views

7-Zip CMD: Add current date to archive and include only the last modified folder in archive

I'm trying to create a backup script with 7-Zip. I have everything else done already, but these two issues are still blocking me. Firstly, I want to add a timestamp with a create date like this: ...
12
votes
4answers
10k 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 ...
9
votes
5answers
6k views

Moving hidden files/folders with the command-line or batch-file

Question Does anyone know of a way to move files and folders that have the hidden, system, or read-only attribute set from the command-line or a batch file? (No, stripping the attributes first is not ...
3
votes
3answers
2k views

Can I get UAC prompt for user from batch file?

Can I get UAC prompt for user from batch file? For example I need put some keys to registry under CurrentControlSet from batch file by reg import path\to\my.reg PS. runas is not a solution as ...
3
votes
1answer
393 views

Running batch file in notification area

Is there any simple code that will make my batch file process, when run, to go to the notification area rather than the taskbar?
4
votes
1answer
2k views

Windows batch file reference to own directory

Suppose you have C:\foo\foo.bat which needs to refer to C:\foo\foo.txt. It may be run from a different directory, but needs to get foo.txt from its own directory, not the current directory. Obviously ...
3
votes
4answers
6k views

How can I start a batch script before logging in?

I have set up my computer to boot at the same time everyday when I am not home. I need it to run a batch file without anyone touching it right when it boots. I have added a shortcut to the file in ...
2
votes
2answers
2k views

How to create a script to disable the shutdown button on Windows 7

I want to create a script in command prompt that will permanently remove a user's right to shutdown a machine. I've done it before, but in Windows XP, and many years ago, and I think I did it in Group ...
2
votes
3answers
694 views

What kind of window's batch file allows zipping of ftp files?

What commands should I use to transfer a file via FTP and then compress the files in a backup directory with a filename containing the date/time for reference? I'd prefer to use batch scripting. The ...
1
vote
6answers
132 views

Batch Renaming Automation *_2.* TO *.*

i am in the process of renaming multiple files from *_2.* to . I want to remove the "_2" suffix My first workaround is trying ren *_2.* *.* but this does not work. Help is apperciated.
0
votes
1answer
2k views

Delete SFX file after extraction

I created a SFX to extract some files. After the extraction, I need that the SFX file is deleted. As far as I have seen, WinRar does not offer such option. So I thought to run some DOS command -prompt ...
0
votes
1answer
18k views

Close command prompt after executing batch file [duplicate]

I have this in a .bat file (windows 7): taskkill /F /IM CouchPotato.exe TIMEOUT /T 5 CouchPotato.exe exit (The couchpotato tends to crash alot.) The command prompt stays open until the process ...
14
votes
5answers
106k views

In Windows 7, how to change proxy settings from command line?

How do I change proxy settings from command line in Windows 7? I'm not talking about just the http_proxy. I need to set system-wide proxy settings (the ones in Internet properties setting). How ...
7
votes
4answers
24k views

Sleeping a computer via batch file in Windows 7

I want to make a batch file that will sleep my computer after a period of time. The closest thing I have found is placing it in standby, but seems to work differently than the sleep button on my ...
13
votes
6answers
3k views

How can I open a console application with a given window size?

The application I want to start is MongoDB. If I would start it normally, it looks like this: I don't like the amount of line breaks and I have a lot of screen space, so I would like to utilize ...
13
votes
3answers
200k views

How can I check a system's current NTP configuration?

I need to verify the current NTP configuration on some Windows systems. Ideally, I'd like to be able to do this via command line instead of navigating through configuration screens (especially since ...
9
votes
1answer
4k views

Why unload variables in Windows batch files

Is it considered necessary or good practice to unload variables used in Windows batch files? For example in the following code, is the set myFolder= at the end necessary? @echo off set ...
5
votes
4answers
7k views

Is it possible to automatically run a batch file as administrator

I am wondering whether it is possible to automatically open a batch file as admin when you double click on the batch file, because the commands need to be run with administrative rights. Note: I ...
6
votes
4answers
7k views

Loading and unloading ISO files in Windows 8

I saw on one site that the new Windows 8 could load ISO images without the help of other programs. Is Windows 8 creating a new drive for every ISO? Or does it have one virtual drive to load all ISOs ...
5
votes
3answers
5k views

Starting services in batch file on windows 7

I have a fairly simple batch file which does just one thing - "net start myservice". This batch file gets shortcut-ed in a program group by installer so that users can simply click on the icon and get ...
2
votes
1answer
3k views

Setting multiple environment variables in a shell spawned via windows batch script

I have a batch file that spawns a shell with a modified path with the following command: cmd /K set PATH=%PATH%;<additional path locations> I want to set additional environment variables for ...
6
votes
3answers
2k views

Configure a Windows shortcut to prompt for input

I swear I remember some way in Windows-past to set up a desktop shortcut that would prompt for input and pass that into the command it's running. Specifically, I want to run a batch file that takes a ...
5
votes
2answers
15k views

Windows batch file if else usage

Sorry I am new to this stuff. I'd like to run in a certain sequence the same bat file with different parameters. I wrote a very simple batch file: @echo off REM Note: to see all command line usage ...
5
votes
3answers
2k views

Creating a folder from first 5 characters of filename in a batch file

Here's what I have: C:\test\12345-test1.txt C:\test\23456-test2.txt C:\test\44444-test3.doc I would like to have the script read the first 5 digits from the file, create a folder with those digits, ...
3
votes
2answers
2k views

Find all MKV files and remove all subtitles

I'm currently looking at a Windows program called mkvmerge. I would like to create a batch file to find all MKV files recursively from a specified path, and remove all subtitles from the MKV files ...
3
votes
2answers
7k views

Run a program in a batch script and wait for it to finish before continuing

I have a very specific requirement. I am attempting to upload files via sftp which uses private keys. I already have a bat file that connects to the host and uploads the file however I need to move ...
3
votes
2answers
5k views

How to run the “runas” command without writing the password

I need to run the "runas" command for log on automatically an Application User, on an Active Directory. Then I need run an executable file. Can I do this in some way or work around to do not type the ...
3
votes
1answer
6k views

Batch File that copies the first 2 lines of a text file into another text file

I have a text file A.txt Pinging [xx.xx.xx.xx] with 32 bytes of data: Request timed out. Ping statistics for xx.xx.xx.xx: Packets: Sent = 1, Received = 0, Lost = 1 (100% loss) I would like to ...
3
votes
3answers
8k views

Dump contents of a cmd prompt into a file, from a batch file

So, I have this batch file that runs every morning at 7 AM and does some work in a Windows command prompt. What I need this batch to also do is save the output of the cmd prompt work that was ...
2
votes
1answer
39 views

How to project all the files or newest files that were added to the directory using gdalwarp and commandline(.bat file)

How am I going to automatically detect all the files that were added to the directory and then project it immediately?Because everyday I am downloading hdf files and then project it from time to time ...
2
votes
2answers
336 views

Need a Batch Toggle that will Launch/Kill Applications when run.

I have a great batch toggle that will show hidden files when run, then hide hidden files when run again. I am wondering if I can create a similar file that will kill a series of work applications ...
2
votes
3answers
4k views

How to start executables through command prompt with space named files and without command prompt waiting program to close?

I would like to create shortcuts to some executable files (exe, bat, com...) on Windows 7 using bat files, but I had some troubles with that: start notepad.exeworks perfectly, but start Foxit ...
0
votes
2answers
1k views

Create .bat file to deactivate device [duplicate]

I'm not familiar with creating .bat files, but I want to create a file to deactivate/disable a network device This is in win7. I have googled some similar problems, but nothing to solve this. pls ...
3
votes
1answer
450 views

How do I go about batch-optimizing image files with a script?

I'm using OptiPNG for a large amount of PNGs I need to optimize. I can get it to run with a batch script where the application and image are in one folder together. start.bat contains: start ...
3
votes
7answers
10k views

Why does the PING command in my batch file execute in a loop?

I created a .BAT file in Windows 7 that has the following line: PING XXX.XXX.XXX.XXX -t (XXX replaces the actual IP number). However, when I double click on this batch file, I can see the PING ...
2
votes
1answer
22 views

Batch file - file name extract

I can get the jpg file names extracted to a text file using : for %%a in (*.jpg) do echo %%a >> get_files.txt and this is the output : Seedling-Acacia-Acinacea-Gold-Dust-Wattle-2-months.jpg ...
2
votes
2answers
4k views

How to create multiple folders and name them by reading lines from text file?

I have a plain text file named Export.txt. It contains a list of geographical places, preceeded by a 3 digit number with leading zeros. Example --START OF FILE-- 001 Aberdeen 002 Bellevue 003 Camas ...
2
votes
2answers
3k views

batch - File last modification time with seconds

I want to know when a file has been modified for the last time. I can get these infos using the following batch script: FOR %%i IN (myfile) DO SET modif_time=%%~ti The problem is that I need ...