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

learn more… | top users | synonyms (1)

13
votes
3answers
20k 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 ...
28
votes
2answers
15k 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. ...
10
votes
3answers
5k 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 ...
5
votes
3answers
789 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 ...
3
votes
2answers
952 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 ...
10
votes
1answer
9k 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 ...
5
votes
2answers
2k 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? ...
4
votes
4answers
20k 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: ...
1
vote
8answers
5k 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 ...
12
votes
4answers
6k 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 ...
7
votes
5answers
4k 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
307 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?
3
votes
5answers
11k views

Batch file to replace a single character in Windows filenames

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 ...
4
votes
1answer
1k 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 ...
2
votes
2answers
1k 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
580 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 ...
0
votes
1answer
996 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 ...
9
votes
5answers
76k 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
20k 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 ...
11
votes
5answers
1k 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 ...
6
votes
5answers
6k 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
4k 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
2k 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
1k 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 ...
6
votes
1answer
3k 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
3answers
1k 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
1answer
1k 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
1answer
4k 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
5k 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
2answers
197 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
2answers
4k 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 ...
2
votes
3answers
2k 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
451 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 ...
2
votes
1answer
240 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 ...
2
votes
2answers
356 views

Windows script to run as a batch to replace character in list of file names

I have 4 files as below: C:\Documents and Settings\vm\AC R\test JE.BOS.20130516.CSV JE.BES.20130516.CSV KFROPN.SAVEFILE.CSV KFBAD.SAVEFILE.CSV I have to replace "." in the filename with "-". But ...
2
votes
2answers
360 views

Batch file to poll a folder for new files

I want to write a batch file which is triggered whenever a new file is added to a particular folder. I can schedule a task using schtasks. But I am looking for a solution based upon interrupt kind ...
2
votes
4answers
4k 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
4answers
16k views

change exe option to run as administrator by bat script on Windows 7

I can't disable UAC in Windows 7 and I want to change .exe option to run as administrator. I can right click on icon and goto compatibility then change this option through GUI but I have to do by ...
1
vote
2answers
157 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 ...
1
vote
2answers
108 views

Batch script move files from Windows Recycle Bin

Is there a way to move files from the Windows Recycle Bin to another folder using a batch script? Background: I have a folder named C:\Temp on my computer. I clear this folder every week using a ...
1
vote
2answers
387 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 ...
1
vote
1answer
59 views

commandline tool to set msspecific “rating” tag in jpeg

I want to create a windows batchfile to set tags of jpeg-files to the contents of a database. i am using ExifTool-6.93 for this. this works perfect setting "keywords". Unfortunatly exiftool cannot ...
1
vote
1answer
6k 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 ...
1
vote
1answer
954 views

How to determine the current directory in a batch file

How can I determine the current directory in a batch file. Other than %~dp0. So that when I run the batch file from source folder (consisting of my files) it returns the path of source folder, where ...
1
vote
3answers
3k 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 ...
1
vote
2answers
607 views

Creating separate archives for a set of files

I have directory containing big list of files. I'd like to gzip each file of a certain mask to a separate archive. How do i do that automatically? For example here's sample directory contents: - ...
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. ...
0
votes
4answers
1k views

Make batch file run in the background of the command prompt while continuing to use command prompt

I am use a windows command prompt for hours a day at work, and I want to spice things up. I want my text color to change color every 1 second. I have a batch script that does this. @echo off set ...
0
votes
1answer
418 views

Batch file for printing text file to virtual port

How can I write a batch file for printing a text file to a dot matrix printer? The printer is connected to the system using USB and the port is the USB002 virtual port.