batch

Easy installation method for windows/ Batch Reference needed?

I have a bunch of files that I need to be able to transport and install quickly. My current method for doing so is moving a flash drive with a readme file of where stuff goes whenever I need to move stuff, which is rather inelegant and cumbersome. My idea for a solution would be to write up a quick script to move files around that I cou...

What is a good windows batch scripting reference guide?

I have found a few guides to be incomplete and hard to follow. Can I get a recommendation for a couple good guides on this subject? ...

How to Pass Command Line Parameters in batch file

I needed to pass id and password to a cmd (or bat) file at the time of running rather than hardcoding them into the file. Here's how I do it. echo off fake-command /u %1 /p %2 Here's what the command line looks like: test.cmd admin P@55w0rd > test-log.txt The %1 applies to the first parameter the %2 (and here's the tricky part) ap...

Automated script to zip IIS logs?

I'd like to write a script/batch that will bunch up my daily IIS logs and zip them up by month. ex080801.log which is in the format of ex*yymmdd*.log ex080801.log - ex080831.log gets zipped up and the log files deleted. The reason we do this is because on a heavy site a log file for one day could be 500mb to 1gb so we zip them up whic...

Can Windows' built-in ZIP compression be scripted?

Is the ZIP compression that is built into Windows XP/Vista/2003/2008 able to be scripted at all? What executable would I have to call from a BAT/CMD file? or is it possible to do it with VBScript? I realize that this is possible using WinZip, 7-Zip and other external applications, but I'm looking for something that requires no external ...

Any way to write a Windows .bat file to kill processes?

So every time I turn on my company owned development machine I have to kill 10+ processes using the task manager or any other process management app just to get decent performance out of my IDE. Yes, these are processes from programs that my company installs on my machine for security and compliance. What I'd like to do is have a .bat f...

How to loop through files matching wildcard in batch file

I have a set of base filenames, for each name 'f' there are exactly two files, 'f.in' and 'f.out'. I want to write a batch file (in Windows XP) which goes through all the filenames, for each one it should: Display the base name 'f' Perform an action on 'f.in' Perform another action on 'f.out' I don't have any way to list the set of ...

What are options available to get cron's results and how to set them up ?

I know that default cron's behavior is to send normal and error output to cron's owner local email box. Is there other ways to get theses results (for example to send it by email to a bunch of people, to store them somewhere, and so on) ? ...

Copying from network share using BAT

What's the best way to copy a file from a network share to the local file system using a Windows batch file? Normally, I would use "net use *" but using this approach how can I get the drive letter? ...

Refer to/select a drive based only on its label? (i.e., not the drive letter)

I'm trying to refer to a drive whose letter may change. I'd like to refer to it by its label (e.g., MyLabel (v:) within a Batch File. It can be referred to by V:\ . I'd like to refer to it by MyLabel. (This was posted on Experts Echange for a month with no answer. Let's see how fast SO answers it ) ...

Creating batch jobs in PowerShell

Imagine a DOS style .cmd file which is used to launch interdependent windowed applications in the right order. Example: 1) Launch a server application by calling an exe with parameters. 2) Wait for the server to become initialized (or a fixed amount of time). 3) Launch client application by calling an exe with parameters. What is the...

How to pass password to scp?

Hello, I know it is not recommended, but is it at all possible to pass the users password to scp? I'd like to copy a file via scp as part of a batch job and the receiving server does of course need a password (no, I cannot easily change that to key-based authentication). TIA Argelbargel ...

Batch file to delete files older than N days

I am looking for a way to delete all files older than 7 days in an MS-DOS batch file. I've search around the web, and found some examples with hundreds of lines of code, and others that required installing extra command line utilities to accomplish the task. Similar things can be done in BASH in just a couple lines of code. It seems ...

Open one of a series of files using a batch file

I have up to 4 files based on this structure (note the prefixes are dates) 0830filename.txt 0907filename.txt 0914filename.txt 0921filename.txt I want to open the the most recent one (0921filename.txt). how can i do this in a batch file? Thanks. ...

Batch renaming of files with international chars on Windows XP

I have a whole bunch of files with filenames using our lovely Swedish letters å å and ö. For various reasons I now need to convert these to an [a-zA-Z] range. Just removing anything outside this range is fairly easy. The thing that's causing me trouble is that I'd like to replace å with a, ö with o and so on. This is charset troubles a...

What is the best way to send large batches of emails in ASP.NET?

I'm currently looping through a datareader and calling the System.Net.Mail.SmtpClient's Send() method. The problem with this is that it's slow. Each email takes about 5-10 seconds to send (it's possible this is just an issue with my host). I had to override the executionTimeout default in my web.config file (it defaults to 90 seconds) li...

Copy files on Windows Command Line with Progress

Does anyone know of a windows commmand-line ( available on XP Pro or later by default ) that could copy a file while showing progress. I do not care if the progress indicator is in a terminal or a GUI window. This is intended to be used during batch file scripting ...

How can you find and replace text in a file using the Windows command-line environment?

I am writing a batch file script using Windows command-line environment and want to change each occurrence of some text in a file (ex. "FOO") with another (ex. "BAR"). What is the simplest way to do that? Any built in functions? ...

Long commands split over multiple lines in Vista/DOS batch (.bat) file

How do I make long commands go over multiple lines in a Vista/DOS batch file? ...

How to create batch file in Windows using "start" with a path and command with spaces.

I need to create a batch file which starts multiple console applications in a Windows .cmd file. This can be done using the start command. However, the command has a path in it. I also need to pass paramaters which have spaces as well. How to do this? E.g. batch file start "c:\path with spaces\app.exe" param1 "param with spaces" ...