Text file containing a sequence of commands or program invocations.

learn more… | top users | synonyms (1)

47
votes
3answers
73k 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. ...
31
votes
4answers
89k 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 ...
27
votes
6answers
183k 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 ...
1
vote
4answers
486 views

add “text” to end of multiple filenames

Using the code below I add text to end of file names which are: 1.mp3 2.mp3 and should be: 1text.mp3 2text.mp3 but it changed to: 1.mp3text 2.mp3text Code: @ECHO ON FOR %%A IN ("C:\Users\...
78
votes
9answers
201k 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"?
25
votes
9answers
126k 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 ...
3
votes
8answers
20k 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
1answer
3k 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 ...
15
votes
5answers
30k 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 ...
6
votes
5answers
24k 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 ...
5
votes
3answers
2k views

Why does “start winword” work 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 ...
2
votes
1answer
24k 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 %var6%...
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 ...
3
votes
4answers
7k views

Change directory in batch file with PowerShell

I need to changed directory using batch file in PowerShell. Let's say the batch file named go.bat has the two lines of code. And I'm in q: directory. c: cd c:\abc\def When I run go.bat, I'm ...
2
votes
2answers
1k views

Open browser window at specified screen / coordinates

A customer has a 6-screen setup for each workstation and would like various pages of a web app to be opened automatically in each of the screens on startup or invoking a shortcut. (The target web ...
1
vote
2answers
7k 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. ...
0
votes
2answers
1k views

Pass shortcut arguments in .bat (batch)

In a .exe shortcut, I can use extra arguments. But how to pass those arguments in a .bat file?
12
votes
2answers
16k 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 ...
9
votes
6answers
35k 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 ...
16
votes
3answers
8k 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? ...
5
votes
4answers
36k 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: 3.11....
10
votes
5answers
11k 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 ...
6
votes
2answers
35k 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 ...
7
votes
3answers
18k views

What does the percent sign (% and %%) in a batch file argument mean?

I think I'm missing something because I can't seem to find what this means. Example: for /D %%A in (*) do "\7za.exe" u -t7z -m9=LZMA2 "%%A.7z" "%%A" That line was supposed to use a command line ...
3
votes
3answers
18k 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
586 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?
2
votes
1answer
708 views

Count number of lines in file using batch

I am using TrailerCount.bat file to count the number of lines in text file using below mentioned code @Echo off ::set newline=^& echo. SET FilePath=%1 Set /a _Lines=0 For /f %%j in ('Type %...
2
votes
2answers
4k 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
897 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 ...
2
votes
1answer
11k views

Windows 7 batch files: How to write string to text file without carriage return AND trailing space?

I am trying to have my batch file write a string of text to a text file. At first, the command I was using was writing an extra carriage return to the end of the string, but I found this command that ...
1
vote
1answer
36k 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 ...
1
vote
1answer
79 views

How to answer batch file [closed]

I lost my administrator right's in recovery. I learned of the super administrator surfing the net and got access using command line. I got a reply :The syntax of this command is: and then it list's ...
1
vote
4answers
14k views

How to automatically make my PC sleep and wake up?

I have a laptop back home with Windows Vista installed. I want my computer to fall asleep automatically at 01:30 AM and wake up at 06:30 AM. I have tried a lot, but making a .bat file which makes it ...
1
vote
1answer
58 views

Run batch job periodically after a process has terminated

I used FreeFileSync to create a batch job to backup my Firefox profile and I'm not sure how to run it periodically (every hour or so) or after Firefox has been closed. FreeFileSync's website ...
32
votes
6answers
467k 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. (I'm working on ...
24
votes
7answers
70k views

Delete all files from a folder and its sub folders

I want to remove all files from a folder structure, so I'm left with an empty folder structure. Can this be achieved in either batch or VBScript scripting? I have tried a very basic batch command, ...
27
votes
5answers
65k views

How do I delete directory trees via batch file on Windows 7?

I want to delete the whole content of a specified folder on Windows 7 via batch file. My problem is, that 'del' or 'erase' only deletes the files, not the folders and 'rmdir' or 'rd' always deletes ...
16
votes
5answers
47k views

How can I perform a ping every X minutes and check the response time?

I am currently working in a big company and we have serious latency issues. This is happening in a process control system, and is unacceptable (Open a valve sometimes take 2 minutes before command ...
14
votes
6answers
10k 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 ...
2
votes
3answers
18k views

How to loop through folders and rename extensions in a batch file?

Selecting a single folder I could run ren *.jpeg *.png I have multiple folders. I want to create a batch file that will loop through all the folders and will rename the files within it. For ...
6
votes
4answers
9k 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 ...
5
votes
2answers
7k 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 ...
4
votes
8answers
17k 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 ...
4
votes
2answers
3k views

The Directory name is too long in batch

I already asked the question in stack overflow, but did not get any answer from anyone. So i am asking the same question here also. I am trying make a program which will calculate size of all folder ...
4
votes
2answers
8k views

How to run a process in the background without keeping a batch file open?

I have a Windows service (the Bamboo integration server) that runs a batch file as a subprocess (a build job) of that script. Within that batch file I would like to be able to start a process (let's ...
3
votes
1answer
9k 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 ...
8
votes
3answers
3k 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
4answers
28k views

bat file to disable ethernet adaptor and then reenable it after windows log in

When I log into Windows 7 I need to wait 10 seconds and then disable the Local Area Connection (ethernet adaptor) and then reenable it. I have looked through the suggested answer: Enable/disable ...
5
votes
2answers
4k 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 ...