bat

Why does this trick not work for me?

http://stackoverflow.com/questions/192479/whats-the-coolest-hack-youve-seen-or-done/192691#192691 I just changed mplayer to woplayer, and I don't see what this does: findstr /I /R %1 dirlist.txt > playlist.txt What's dirlist.txt? ...

Execute with parameters

I'm having difficulty executing a batch file in Java that expects parameters. These parameters may contain spaces so I need to wrap them in quotes. I will also need to do the same thing for Linux because some of the parameters may contain special characters such as !. Non-functional Windows code: ProcessBuilder pb = new ProcessBuilder(...

bat file: get parent pathname

The following mostly works. 'Mostly', because the use of the SOMETHING..\tasks\ pathname confuses Spring when a context XML file tries to include another by relative pathname. So, what I seem to need is a way, in a BAT file, of setting a variable to the parent directory of a pathname. set ROOT=%~dp0 java -Xmx1g -jar %ROOT%\..\lib\ajar.j...

link a batch scrript (.bat file) to a different console/shell on Windows XP?

Hi All, Is there any way to link batch script (.bat files) so that they run via another shell/console and not cmd.exe ? For instance, if one install powershell or others (a few are open-source projects are available on soureceforge), how to link it to your bat files ? I looked in the "file types" menu but it seems that the bat extensi...

What's the syntax for .bat?

if "%OS%"=="Windows_NT" @setlocal ... if "%OS%"=="Windows_NT" @endlocal Does the above basically mean this: if(OS == 'Windows_NT'): ... endif I've curious what's setlocal for ? EDIT Now the only uncertain is:how do bat identify the endif? ...

Is there any way to trace through the execution of a batch file?

I inherited some large batch files, and I'd like to rewrite them to a more "developer friendly" language. I'd like to find out the following things: what other scripts it calls what other processes it starts what files does it write to what environment variables it uses, which ones does it set For the last point, I'm aware I can do...

Writing a simple bat file?

I am writing a simple batch file and i get this "The syntax of the command is incorrect" error for the if statement.The batch file is as below: @echo off set ARCH=%PROCESSOR_ARCHITECTURE% if %ARCH% == 'x86' ( ) I also tried if %ARCH% EQU 'x86' What is wrong with the if statement? ...

Run bat file in Java and wait

You would think that launching a bat file from Java would be an easy task but no... I have a bat file that does some sql commands for a loop of values read from a text file. It is more or less like this: FOR /F %%x in (%CD%\listOfThings.txt) do sqlcmd -Slocalhost\MSSQL %1 %2 -d %3 -i %CD%\SQLScripts\\%%x exit Don't worry about the spe...

Run bat file in Java and wait 2

This is a followup question to my other question : http://stackoverflow.com/questions/2434125/run-bat-file-in-java-and-wait The reason i am posting this as a separate question is that the one i already asked was answered correctly. From some research i did my problem is unique to my case so i decided to create a new question. Please go ...

substring using bat command

Hi all, I have the following thing in my bat file. say set path=c:\temp\test so basically i want to have an output which would give me the result as c:\temp\ i didnt find any indexof equivalent in bat command. Thanks. ...

feeding input to a java process from a batch file

If I have a simple java program that processes lines of text from standard input, then I can run it with the following script: @Echo off java Test < file.txt pause exit The script redirects lines of input from file.txt into the java program. Is there a way that I can avoid having to use a separate file? Or is this the easiest way? T...

How do I make windows prompt RE-read environment variables?

Every time I modify the PATH environment variable, I have to close and re-open the prompt, is there a command to make my prompt refresh environment variables? ...

Writing a simple batch file to setup a variable?

I want to write a simple batch file where i want to setup a environment variable based on the machine architecture. It is as below: set ARCH=%PROCESSOR_ARCHITECTURE% echo %ARCH% if %ARCH%==x86 ( set JAVA_ROOT=C:\Progra~1\Java\j2re1.4.2_13 ) else ( set JAVA_ROOT=C:\Progra~2\Java\j2re1.4.2_13 ) echo JAVA_ROOT is %JAVA_ROOT% On 64-bi...

How to run a bat file from a C# program?

so i need a simple function to run bat file. How to do such thing? ...

Getting the location of the `.bat` file from within it

I'm writing a .bat script for Windows. Is there any command that I can use within the script to retrieve the directory that the script is in? ...

windows bat file: how to strip the path-part from a absolute filepath

hello i have a variable like this: set file=c:\dir\foo\bar\file.txt how can i get just the path-part into another variable? echo %pathpart% should give c:\dir\foo\bar\ thanks! ...

Remove Trailing Slash From Batch File Input

I have a batch file that I want to improve. Instead of requiring a user to provide a folder path without a trailing slash, is there an easy way for me to just remove the last character from the path if there is a slash on the end? :START @echo What folder do you want to process? (Provide a path without a closing backslash) set /p datapa...

Copy & rename file using .bat file language?

I want to make a .bat to copy & rename a file multiple times. I want to have a list of names, and an original file, then I want to copy that file and rename it for each name on the list. How I can do this using a .bat file? Also is it possible to run winrar fromthe .bat to .rar or .zip every file after copying/renaming? Example: $fi...

bat file using winrar taking too long to run

hi guys, i have this scripts which extracts all my folder's and files from my c:\projects locations and put its in winrar and transfers them to c:\backup\project for /f "delims==" %%D in ('DIR C:\projects /A /B /S') do ( "C:\Program Files\WinRAR\WinRAR.EXE" m -r "c:\backup\projects.rar" "%%D" ) i have also tried the below script whic...

Batch file to check if a file exists and raise an error if it doesn't

This batch file releases a build from TEST to LIVE. I want to add a check constraint in this file that ensures there is an accomanying release document in a specific folder. "C:\Program Files\Windows Resource Kits\Tools\robocopy.exe" "\\testserver\testapp$" "\\liveserver\liveapp$" *.* /E /XA:H /PURGE /XO /XD ".svn" /NDL /NC /NS ...