batch

Why does findstr not handle case properly (in some circumstances)?

While writing some recent scripts in cmd.exe, I had a need to use findstr with regular expressions - customer required standard cmd.exe commands (no GnuWin32 nor Cygwin nor VBS nor Powershell). I just wanted to know if a variable contained any upper-case characters and attempted to use: > set myvar=abc > echo %myvar%|findstr /r "[A-Z]"...

[Batch]: Remove language from regional settings in Windows

Would it be possible to somehow, probably in the registry, remove a language from your accounts regional settings on Windows XP using batch scripting? If someone could point me to the correct registry key i could then just export it modified and import it with Batch. ...

Accessing property file through batch script

Hi everyone, I'm trying to write a batch script, this script is responsible to launch a jar with one parameters. This parameter indicate to my jar wich property file to use in order to setup some configuration. Then the script will zip the results produced by the jar and send them to a location. But in order to set the name of the zi...

How can we stop a running java process through windows cmd?

I am a newbie in cmd, so please allow me to ask a stupid question: How can we stop a running java process through windows cmd? For example, if we start jetty(a mini web server) with the following cmd: start javaw -jar start.jar How do we find the process and stop it later? Obviously the following cmd does not work: stop javaw -jar ...

batch file to merge .js files from subfolders into one combined file

I'm struggling to get this to work. Plenty of examples on the web, but they all do something just slightly different to what I'm aiming to do, and every time I think I can solve it, I get hit by an error that means nothing to me. After giving up on the JSLint.VS plugin, I'm attempting to create a batch file that I can call from a Visua...

windows batch file to call remote executable with username and password

Hi I am trying to get a batch file to call an executable from the server and login. I have a monitoring program that allows me send and execute the script. OK here goes.... //x3400/NTE_test/test.exe /USER:student password Now this doesn't work. The path is right because when I type it in at the run menu in xp it works. Then I manu...

Batch commands execution order

I'm looking to run a second batch command from .bat but after the first command has been done. REN "myfile.txt" "my_file.txt" start "title" "path" Here, I want the rename command to be executed before the process I wanted to start that has been terminated or executed. why it doesn't work in sequence order? Update: Both commands work...

Bat file to call A.bat if time is less than 19:45 and to call B.bat if time is greater than 19:45

Bat file to call A.bat if time is less than 19:45 and to call B.bat if time is greater than 19:45 (i can not use windows task scheduler in this case because i have setting which makes my download manager to trigger this parent bat file each time a file is downloaded through this download manager) ...

Controlling Windows Media Player through PHP / batch files

I'm currently writing a tiny webapp for my HTPC (actually, a PC serving as both a media player and web- / fileserver) that will allow me to remotely control the playing of audio, without having to turn on my TV just to switch songs. I'm using Windows Media Player as my audio player of choice, and I thought I could control it through PHP...

hide the console window when use batch file to launch a java program?

I use a batch to launch my java application like this start /min java -splash:resources\images\splash\splash.gif com.myproj.MyProjApp exit There is still a icon on the taskbar. what I want is hide the console window and only add ONE icon which is my application on the taskbar when I click that batch file? ...

variables in batch scripts

I'm trying to set up a batch file to automatically deploy a php app to a web server. Basically, what I want is an entirely automated process: I would just give it a revision number from the repository and it would then export the files, upload via ftp and then update deployment info at the repo host (codebase). However, I'm starting ...

What is wrong with this recursive Windows CMD script? It won't do Ackermann properly

I'm trying to get to calculate the Ackermann function. A description of what I'm trying to achieve is at http://rosettacode.org/wiki/Ackermann_function. Using the test script, Test 0 4 gives me 5 which is correct. However Test 1 4 gives 5 not 6, and Test 2 4 gives 5 instead of 11. Where am I going wrong? ::echo off set depth=0 :ack i...

How to use forfiles (or similar) to delete files older than n days, but always leaving most recent n

(Using Windows 2000 and 2003 Server) We use forfiles.exe to delete backup .zip files older than n days, and it works great (command is a bit like below) forfiles -p"C:\Backup" -m"*.zip" -c"cmd /c if @ISDIR==FALSE del \"@PATH\@FILE\"" -d-5 If a .zip file fails to be created, I'd like to ensure that we don't end up with 0 .zip files in...

How to handle carriage return with windows batch script?

Hi, I want to use bat to automate some of my work. It should first look up the value of a certain registry key, and then copy some files to the directory that included in the registry key value. I used reg query command to look up registry, such as: REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PROCE...

Windows Batch file to echo a specific line number

So for the second part of my current dilemma, I have a list of folders in c:\file_list.txt. I need to be able to extract them (well, echo them with some mods) based on the line number because this batch script is being called by an iterative macro process. I'm passing the line number as a parameter. @echo off setlocal enabledelayedexp...

How do I understand the 3 lines batch script?

ECHO @ECHO OFF ^& (IF EXIST "%%~dp0%~n1.swf" (DEL "%%~dp0%~n1.swf")) ^& %mxmlcPath% %opts% -file-specs "%%~dp0%~nx1" ^& (IF EXIST "%%~dp0%~n1.swf" (CALL "%%~dp0%~n1.swf") ELSE (PAUSE)) > "%~dpn1.bat" REM Immediately execute the generated bat @ECHO on CALL "%~dpn1.bat" It's really a mess for me(like ECHO @ECHO OFF,what's that intended f...

I need to write a batch file to set the system environmental variables ,

I need to write a batch file to set the system environmental variables as shown below WRD_WF_ROOT=e:\wrd_ntl_v23 WRD_Wld_ROOT=e:\wrd_ntl_v23 and I need to run the script for 250 users . ...

How to execute programs in the same directory as the windows batch file?

I have in the same folder a .bat and a .exe file. I couldn't call the .exe file from the .bat unless I put the full absolute path to it. Is there a way to don't specify the path? ...

Is It possible to set environment variable and echo it in a single line batch script?

set A=2 && echo %A% This does not echo A as 2 in windows. Is there any way to do it? A=2 ; echo $A works in bash. I want a similar behavior on windows ...

Windows batch file: choosing a file from a directory based on directory name

I don't do windows batch programming, nor do I need to go that far down the rabbit hole. I have directory structures as such: dir1000000/file.txt dir2000000_1/file.txt dir2000000_2/file.txt I need to select the file.txt from the path with the lexicographically greatest value, i.e. dir2000000_2/file.txt. How do I go about doing this? ...