batch-file

Batch file editor for eclipse?

Is there a plugin that will give me syntax highlighting, etc. for windows batch (.bat/.cmd) files? I've been googling but no luck so far .... ...

How do I determine whether a file is in use?

How can I determine whether a file is in use via VBScript or a batch file? It can be a separate utility. I've had a look at Handle but sometimes the handles don't line up with filenames, e.g. some DLLs, and it doesn't do partial searches (though I could presumably use some of the text processing utils on its full output to handle that ...

How to sleep for 5 seconds in Windows's Command Prompt? (or DOS)

Windows's Snipping tool can capture the screen, but sometimes I want to capture the screen after 5 seconds, such as taking an image being displayed by the webcam. (run the script and smile at the camera, for example). So in Ruby, I could do something like sleep 3 system('c:/windows/system32/SnippingTool.exe') but not all computer ha...

Help with for /f batch file

heres my code: start /realtime /b /wait .\jampDed.exe for /f "tokens=1-5 delims=:" %%d in ("%time%") do rename .\CIA_Secure_Host2\qconsole.log %%d-%%e-%%f start .\Serv.bat cmd this batch is supposed to run the program in a window, and when it quits, is supposed to rename the file qconsole.log to the current time, and then relaunch the...

VBScript, Batch or PowerShell Script?

I'm trying to run various commands using psexec.exe from Windows Sysinternals. What I need is a simple script to read the output of those commands. For example if everything went OK, then it returns a 0. If something went wrong, then it will spit out an error code. How can it be done? ...

How do I compare timestamps of files in a DOS batch script?

In DOS batch files, the method of achieving certain things is somewhat obfuscated. Fortunately, there is a fantastic reference site for DOS batch scripting: Simon Sheppard's SS64. (The same site also has plenty of information about Bash.) One difficulty is branching execution based on whether a directory is empty. The obvious if exist "...

How do I append to an environment variable in a batch file?

I don't know how to describe exactly what I'm trying to do but here's an example batch file that demonstrates what I can't figure out.: I've got a batch file. Inside that batch file I'm trying to create a directory: Set CopyFrom = %~dp0 if Exist "%ProgramFiles(x86)" ( Set TargetDir = %ProgramFiles(x86)%\My Directory Name has spaces...

run bat file in background

Hi all, I want to run a bat file in background. I searched in google and I found some examples using hstart and cmdow. But Isn't anyway to do this with windows commands? I really feal good when I don't add extra programs to my project ! thanx in advance ...

Is it possible to put a new line character in an echo line in a batch file?

Is it possible to put a new line character in an echo line in a batch file? Basically I want to be able to do the equivalent of: echo Hello\nWorld You can do this easily enough in linux but I can't work out how to do it in windows. ...

Need help in finding the root cause in this wrong batch command

IF %processor_architecture% == AMD64 (SET querypath=hklm\software\x) ELSE (SET dsetquerypath=hklm\software\y) FOR /F "tokens=* delims=\" %%G IN ('REG QUERY "%querypath%" 2^>NUL') DO ECHO %%G Let me explain what im trying to accomplish out of this batch command. Basically there is a tool which gets intalled on hklm\software\x(on 32bit ...

How do I get each comp result ?

I would like to check diffs and when files are not same,stop compare files. Compare any files C:/UML/reports/* and C:/UML/Test/*. In this two directory has same file names and also aim is to want to compare same file by name. I try to that by below code in .bat file. diff.bat @echo off for %%i in (C:\UML\reports\*) do comp %%i C:\UML...

Is a makefile basically the same thing as a batch file?

I know all about batch files and made them before, but I'm unclear on what a makefile is. It looks like a batch file. What are the similarities and diffferences? ...

Dos/Windows Batch help in setting a variable from command output

I need to run a simple find command and redirect the output to a variable in a Windows Batch File/DOS. I have tried this: set file=ls|find ".txt" echo %file% But it does not work. If I run this command it works without problems: set file=test.txt echo %file% So obviously my command output is not being set to my variable. Can any...

Trying to store the out of a command to a variable and trying to match in batch file

I am trying to set variable to a registry path. And then querying a registry and trying to match with the variable.If both are same then goto execute. But for some reason Im getting error and looks like there is some problem with this command set var=HKEY_LOCAL_MACHINE\System\x IF reg query==var GOTO EXecute ...

Within a windows batch file, how do I set an environment variable with the hexadecimal representation of a decimal number?

When using the Windows set /p and set /a commands to accept a hexadecimal value from the command line and convert it to decimal. What I need is to be able to take a decimal value and set and environment variable with its hexadecimal equivalent. Current batch file coding: @echo off set HexV1=%1 set HexV2=%2 set /A DecV1=0x%HexV1% set /A...

.BAT file that starts ASP.NET Development Server, then opens in browser

I am trying to create a .bat file that starts the ASP.NET Dev Server outside of Visual Studio, and then opens the site in a browser. What I have so far does successfully start the Dev Server, but then it stops there and doesn't open the browser. Here is what I have in my .bat file: "C:\Program Files\Common Files\Microsoft Shared\DevSe...

'javac' cannot be found problem

I have a Java application hosted on a remote tomcat instance that executes a bat file which contains the following line javac filename.java I receive the following error :- 'javac' is not recognized as an internal or external command, operable program or batch file. I have set the path in the environmental variables. I tri...

Batch delayed expansion not working.

Ok, I'm getting crazy and I don't know what else to do, I've tried several things and nothing is working. Look at this sample code (test.cmd): setlocal enabledelayedexpansion enableextensions set VAR=before if "%VAR%" == "before" ( set VAR=after; if "%VAR%" == "after" @echo If you see this, it worked ) This is the generated o...

Resources To Learn About Batch Files

In my new project I need to use batch files(many of them), but now I need to know about they and where can I read some good tutorials to use they very good ;) PS: I need to distribute my application for end-users. ...

Batch File to Delete Folders

I found some code to delete folders, in this case deleting all but 'n' # of folders. I created 10 test folders, plus 1 that was already there. I want to delete all but 4. The code works, it leaves 4 of my test folders, except that it also leaves the other folder. Is there some attribute of the other folder that's getting checked in the b...