batch

Vista batch for running app odd days

I have read all that stuff about time saving and I wan't to create a shortcut to my IM app that won't run on odd days. It is possible in Windows Vista batch? ...

Batch files, $ : and ~

Hello all :) I've been writing an application which will need to expand environment strings in a file. To that effect, I could use the standard windows API function, ExpandEnvironmentStrings: http://msdn.microsoft.com/en-us/library/ms724265(VS.85).aspx I do have a few problems with that function though. First: The size of the lpSrc an...

Batch file to search for string in most recent file

Hello I have alot of log files which need searching for certain strings and was wondering if I could make a batch file to automate this job for me? All I need it to do is locate the most recent log in a certain directory then search for the string in that file. I have found the below code on this website which works great to open the m...

Modifying the Power Scheme using Batch Files in Windows XP

I'm trying to write two batch files that will allow me to switch the Power Scheme (Control Panel -> Power Options -> Power Schemes Tab) from Home/Office Desk to Portable/Laptop and back. My operating system is Windows XP SP3. My reason for doing this is because I want to disable SpeedStep when I'm playing games on my laptop (i.e. put it...

Windows command to get service status?

I need to know the status of a service at the end of my batch script which restarts services using "net stop thingie" and "net start thingie". In my most favorite ideal world, I would like to e-mail the state to myself, to read on cold winter nights, to reassure myself with the warmth and comfort of a server that I know is running right...

How will i create batch file like Zend_tool or symfony.bin ?

I want to write batch file for my own php framework. for example i will use it to create controller or modul .If you have already used Zend or symfony you may know how to use .bin file of framework. I only know coding with php so i need clear description of how to write batch file .I looked symfony.bin's source code but code is very simp...

Batch File - Into a Variable

Hi guys Havin' problems tryin' to get the string after the : in the following two lines into two seperate variables from the bottom of a text file called file.txt for example Number of files to delete: 27 Total Total size of files to delete: 1,427 KB I just want the 27 in one variable, and the 1,427 in another. These are randomly gen...

Putting bat file inside a jar file

I have a java class that uses a bat file to execute commands. However I developed it in Eclipse IDE. It works fine in there. But as I export it in a jar file, it fails to find the bat file that was included.(gives me an IOException) The file structure in eclipse is as follows : Project1 ---->src ------>com.myproj -------->BatFileRead....

Is there a way to redirect stderror to stdout for the duration of a script in Windows?

As a long time UNIX shell scripter / release engineer coming into the Windows environment full time with my latest job, there are some things I inevitably miss. One of them is my trusty old 'exec 2>&1' which in the Bourne shell permently knots together stderr and stdout for the duration of the script, so that logging will capture everyt...

How does "FOR" work in cmd batch file ?

I've been programming in dozens of languages for 20 years but I could never understand how "FOR" work in windows cmd shell batch file, no matter how hard I tried. I read http://www.amazon.com/Windows-Administration-Command-Line-Vista/dp/0470046163/ref=sr_1_1?ie=UTF8&s=books&qid=1241362727&sr=8-1 http://www.ss64.com/nt/for...

start windows console app parameters

what parameters should i use to start a console app minimized or hidden? is this possible without using a 3rd party program? with a batch file ...

Batch extract rars with spaces in names

I am trying to batch extract some rar's that are in some zip in some directories. Long story short this is my loop through the rar files: for %%r in (*.rar) do ( unrar x %%r ) Problem is that %%r gets the wrong value. If the files name is "file name.rar" then %%r gets the value "file" - it stops at the first space in the file name. ...

How to set processor affinity from Batch File for Windows XP?

I've got a dual processor machine and I would like to launch an executable via a batch file on both processors. For example: (1) Launch Notepad.exe on Processor 1, and (2) Simultaneously, Notepad.exe on Processor 2 Currently, I'm using the following in my batch file, since my executable was "difficult" to launch and needed a return in...

Run batch file when argument contains quotes and spaces (from .NET framework)

I have a bat file which sets some environment variables, and then executes a command on the command line. I want to replace the hard coded command with one passed in via a parameter. So: :: Set up the required environment SET some_var=a SET another_var=b CALL some.bat :: Now call the command passed into this batch file %1 The prob...

Windows batch file for iterative invocation of other batch files

Consider a directory structure containing the following files: \1.3\Baseline\GeneratedScripts\One\FullInstall.cmd \1.3\Baseline\GeneratedScripts\Two\FullInstall.cmd \1.3\Baseline\GeneratedScripts\Three\FullInstall.cmd \1.3\Patches\Patch1\GeneratedScripts\One\FullInstall.cmd \1.3\Patches\Patch1\GeneratedScripts\Two\FullInstall.cmd \1.3\P...

How do I check that a parameter is defined when calling a batch file?

I'm trying to use the following validation logic in a batch file but the "usage" block never executes even when no parameter is supplied to the batch file. if ("%1"=="") goto usage @echo This should not execute @echo Done. goto :eof :usage @echo Usage: %0 <EnvironmentName> exit 1 What am I doing wrong? ...

Recovering from an invalid GOTO command in a Windows batch file

In a Windows batch file, I am taking an optional parameter that allows the caller to jump to the middle of the batch file and resume from there. For example: if [%1] neq [] ( echo Starting from step %1 goto %1 if %errorlevel% neq 0 goto error ) :step1 :step2 ... goto end :error echo Error handler ... :end If the supplied paramet...

Minimizing or closing a program with batch script

I am writing a batch script intended for handling some tasks in my (and a few colleagues) windows startup. The main thing that needs to happen is the killing of a few processes that do to this being a large corporate environment are started as default. They interfere with our work so we have to kill them... I know it's stupid but thats b...

How can I execute a set of .SQL files from within SSMS?

How could I execute a set of .SQL files (each does some data transformations) from within SQL Server Management Studio? What other alternative are there for executing .SQL files in batch? ...

Piping Batch File output to a Python script

I'm trying to write a python script (in windows) that runs a batch file and will take the command line output of that batch file as input. The batch file runs processes that I don't have access to and gives output based on whether those processes are successful. I'd like to take those messages from the batch file and use them in the pyth...