batch-file

How to print a newline in an MS-DOS script?

I want to print the output of a program in MS-DOS so I wrote a .bat file that says: cls ruby foo.rb But the output - as it appears on my command prompt - looks like this: c:\workspace>ruby foo.rb foo output c:\workspace> I wanted to insert a newline into the output using MS-DOS because I don't want to pollute my Ruby code with anyt...

how to give wait & close the command prompt in java

I am using the following code to execute a batch file: java.lang.Runtime rt = java.lang.Runtime.getRuntime(); Process pr = rt.exec("MyBatch.bat"); My batch file takes some time to execute. I want my servlet process to wait till the batch file execution completes. I would like to close the command prompt after executing the batch file....

Batch Script to Install or Uninstall a .NET Windows Service

I have no experience writing batch scripts, but I was wondering if there was a way to install a .NET Windows service using installutil.exe using such a script, or uninstall the service if it is already installed, ideally with some kind of confirmation that I actually would like to perform the uninstall (e.g. press y to uninstall). Here ...

Can system Environment Variables be set via Windows Logon Scripts?

I have an MSI-packaged application that is being deployed via Group Policy Objects (GPO) from a Windows 2003 Domain Server to all the XP client machines in the network. This application reads two environment variables for its configuration (which server IPs to talk to) and it seems like we'd also want to push this configuration via a GP...

How do I preserve variables in batch scripts when set in "for" loops?

I need to set my classpath using all of the jars in a particular directory. Bash does it as follows: CP_DELIMITER=; for j in "$MY_HOME/javalib/*.jar"; do if [ "$CP" ]; then CP="$CP$CP_DELIMITER$j" else CP="$j" fi done But "for" works differently in DOS, and essentially sends the command to the shell, but ...

Escaping a backslash in Batch File using FINDSTR

In my svn Pre commit hooks I use findstr to block certain file types beign committed. I now want to extend this to directories, in the first instance \obj\ directories however I am having problems with the Regular expression and escaping the \ of the dir Currently I have "C:\Program Files\VisualSVN Server\bin\svnlook.exe" changed -t ...

exit the batch file after running using java

Hi I know how to start the batch file using java code. When i run the batch file command prompt is opened. To close the command prompt i am using the taskill /im cmd.exe. but the problem is that the command prompt that is used to start the jboss is also closed. i want to kill the cmd with a particular process id. How do i get the proces...

how to run the batch file from any folder

cd ../../jobs set CLASSPATH=.;../xyz.jar;../mysql-connector-java-5.1.6-bin.jar java folser.folder1 ../Files/MySQL.xml cd .. I need to run the batch file from any directory. I have set the paths for java. Can anybody help me? ...

Is there a command line that I can the full path to current directory?

Is there a command line that I can get the full path to current directory?(in DOS) ...

Batch files: Get value out of string

Hi, I receive a file that contains the following: \direcotry1\directory2\directory3\file1 \direcotry1\file2 \direcotry1\directory2\directory3\directory4\file3 \direcotry1\file4 \direcotry1\directory2\file5 file6 The amount of files in the file and the amount of directories are variable. What I need is the filename (file1, file2, fil...

Interactive Batch File

How to proceed with an interactive batch file? Eg., DO you want to continue? [y/n] If 'y' Goto Label1 Else Goto Label2 Thanks ...

How do I run a batch file from my Java Application?

In my Java application I want to run a batch file that calls "scons -Q implicit-deps-changed build\file_load_type export\file_load_type" It seems that I can't even get my batch file to execute. I'm out of ideas. This is what I have in Java: Runtime.getRuntime().exec("build.bat", null, new File(".")); Previously I had a python Scons...

calling batch files inside nant

How can I call a batch file inside a nant script??? (Maybe having a target that calls the batch file). ...

Msys Git Merge Tool Command Options Issue

I'm using msys Git for source control on a Windows machine and I'm trying to figure out how to get my merge tool, WinMerge, to work with Git. I've followed the instructions on this blog to the best of my ability since it's the closest I've found to what I'm trying to do. Basically what I did was: Modify my .gitconfig file to include th...

What is the best way to do a substring in a batch file?

I want to get the name of the currently running batch file without the file extension. Thanks to this link, I have the file name with the extension... but what is the best way to do a substring in a batch file? Or is there another way to get the file name w/o the extension? It is safe to assume 3 letter extensions in this scenario. ...

Closing Batch File

I wrote a batch file, which has 3 .bat file running in background. I have another batch file which has 3 .bat file, which is used to stop those .bat file which ran in first batch file. All this is working fine, but after stopping those .bat files, first batch file's command window is not closing. I gave 'exit' to both the batch file whic...

"start" does not work in bat file when used as filetype handler in Firefox

I have a batch (bat / cmd) file which should act as a filetype handler for jpeg files in Firefox, I just want it to copy the file to another folder, and then open the file in the Picasa Viewer. When I run it from the command line, even if I'm running it from another folder, it works fine, and opens Picasa Viewer. However, when setting it...

Shell script - search and replace text in multiple files using a list of strings

[edited] I have a file "changesDictionary.txt" containing (a variable number of) pairs of key-value strings. e.g. "textToSearchFor" = "theReplacementText" (The format of the dictionary is unimportant, and be changed as required.) I need to iterate through the contents of a given directory, including sub-directories. For each file en...

How do I run a bat file in the background from another bat file?

I have a "setup" script which I run in the morning which starts all the programs that I need. Now some of those need additional setup of the environment, so I need to wrap them in small BAT scripts. How do I run such a script on Windows XP in the background? CALL env-script.bat runs it synchronously, i.e. the setup script can continue ...

How to stop script from running?

I have the following Script, more +1 "C:\Documents and Settings\Administrator\Desktop\Backup Data\import file\1.txt" > "C:\Documents and Settings\Administrator\Desktop\Backup Data\import file\2.txt" "C:\Program Files\Microsoft Office\Office11\MSACCESS.EXE" "C:\Power Play\Daily\Daily.mdb" /x "Macro1" DEL "C:\Documents and Settings\Admi...