batch

Search and replace with a batch file

I am writing a batch file script using Windows command and want to change each occurrence of some blank space with "," What is the simplest way to do that? ...

How do I perform string operations on variables in a for loop?

This sounds dumb, but I can't get it to work. I think i just dont' understand the difference between %%v, %v% and %v Here's what I'm trying to do: for %%v in (*.flv) do ffmpeg.exe -i "%%v" -y -f mjpeg -ss 0.001 -vframes 1 -an "%%v.jpg" This successfully generates a thumbnail for each of the movies, but the problem is: movie.flv -> m...

Licensing and auto-delete of a program

I have an application which get copied and run on client machines. The program is in the form of an Adobe Projector file. I want to write a process that checks when the program starts running whether or not the license is still active, and if not, delete the entire program. The program itself knows the real date that it was installed, ...

UTF-16 to UTF-8 conversion (for scripting in Windows)

Hi, what is the best way to convert a UTF-16 files to UTF-8? I need to use this in a cmd script. ...

How To Set Errorlevel On Exit of MFC App

I have an MFC legacy app that I help to maintain. I'm not quite sure how to identify the version of MFC and I don't think it would make a difference anyway. The app can take some parameters on the command line; I would like to be able to set an errorlevel on exiting the app to allow a bat/cmd file to check for failure and respond app...

Locate the path of an Apache server on windows.

For a windows script I am writing, I need to detect if the machine has Apache 2.2 installed, and to find the application path. One solution I came up with is to wget http://localhost:8080/server-info and parse the root and the config file from it. This would fail if the server does not use port 8080 Another option would be to call “s...

Batch Scripting Documentation

Is there some nice documentation for windows batch scripting I can download and refer to while offline? ...

Batch script for re-creating database from source control

Hi Everyone, As far as I understand, if I want to get my database under source control then I need to be checking in change scripts for each change and then running them from some revision to get the correct DB. I am trying to make a batch file that will be checked in too, that allows other developers on the team to re-build the DB loc...

How to convert the value of %USERNAME% to lowercase within a Windows batch script?

I'm automating some source control software functionality using a dot bat script but given that our svn repos are hosted in a *NIX box, I'm facing the eternal case problem between these two worlds. Is there any cmd.exe function to convert the value of the Windows system variable %USERNAME% to lower case? Thanks much in advance! ...

What would be the Windows batch equivalent for HTML's input type="password"?

I need to get authentication credentials from the users within a Windows script but the classic "first Google result" approach: SET /P USR=Username: SET /P PWD=Password: is less than satisfying, so I was wondering if there's let's say an "equivalent" to HTML's input type="password"? Any comment would be really appreciated, thanks mu...

Running a Windows Batch Script to Startup Multiple Files

I'm trying to replace the programs that run from my startup directory with a batch script. The batch script will simply warn me that the programs are going to run and I can either continue running the script or stop it. Here's the script as I have written so far: @echo off echo You are about to run startup programs! pause ::load o...

Rename existing files in XP useing a batch file (Backup purpose)

pkzip25 -add=all -dir=current -silent -locale -exclude=DistData.zip -exclude=extract.bat -exclude=run.bat -exclude=pkzip25.exe -exclude=extracted.txt -exclude=zipped.txt -exclude=.\STORE DistData.zip *.* pkzip25 -view -directories DistData.zip >zipped.txt copy DistData.zip ..\BKX\DistData_1.zip CD\BKX rename DistData_1.zip DistData_2.zi...

Windows Xp or Vista: How can I run a batch file in the background (no windows displayed) ?

I know I have already answered a similar question (Running Batch File in background when windows boots up), but this time I need to launch a batch: from another batch without any DOS windows displayed with all arguments passed to the invisible batch The first batch is executed in a DOS windows. However, I do not want the second batch...

How do I create a batch file timer to execute / call another batch throughout the day

How do I create a batch file timer to execute / call another batch through out the day Maybe on given times to run but not to run on weekends ? Must run on system times can also be .cmd to run on xp server 2003 ...

How do I concatenate JavaScript files into one file?

Hello, I want to create a compiled JavaScript file for my website. For development I would prefer to keep the JavaScript in separate files and just as part of my automated scripts concatenate the files into one and run the compressor over it. My problem is that if I use the old DOS copy command it also puts in the EOF markers which ...

Remove quotes from named environement variables in Windows scripts

I want to store a URL prefix in an Windows environment variable. The ampersands in the query string makes this troublesome though. For example: I have a URL prefix of "http://example.com?foo=1&bar=", and want to create a full URL by providing a value for the bar param. I then want to launch that url using the "start" command. Addin...

Batch file called from Javascript/XPCOM doesn't show command prompt window

I am calling a batch file from Javascript in this fashion: function runBatch(){ var exe = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile); exe.initWithPath("C:\\test.bat"); var run = Components.classes['@mozilla.org/process/util;1'].createInstance(Components.interfaces.nsIPr...

python as a "batch" script (i.e. run commands from python)

I'm working in a windows environment (my laptop!) and I need a couple of scripts that run other programs, pretty much like a windows batch file. how can I run a command from python such that the program when run, will replace the script? The program is interactive (for instance, unison) and keeps printing lines and asking for user input...

Handling nmake errorlevel/return codes

Hi all, I have an nmake-based project which in turn calls the asp compiler, which can throw an error, which nmake seems to recognize: NMAKE : fatal error U1077: 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe' : return code '0x1' However, when I call nmake from within a batch file, the environment variable %ERRORLEV...

Batch File

Hi All I have a batch file that does this. ECHO A41,35,0,a,1,1,N,"Mr ZACHARY KAPLAN">> test.txt There are about 30k similar lines. It takes the batch file about 5 hours to run. Is there a way to speed this up? /Jeanre ...