FAQ Database Discussion Community


Starting sikuli from batch file, command prompt text won't get coloured

batch-file,dos
I have made a combination of scripts to execute my test. Now I have a Main script as well, this one executes the others when needed. I made a batch file to execute my Run.sikuli file. It looks like this: start /min C:\Users\<userName>\Documents\Sikuli\runIde.cmd -r C:\Users\<userName>\Documents\Sikuli\Run.sikuli Now the above part works...

make many process wait before the main process

batch-file,cmd,dos,wait
I have this code: Start "" robocopy F:\DATA1 D:\Backup\ Start "" robocopy G:\DATA2 D:\Backup\ Start "" robocopy H:\DATA3 D:\Backup\ Start "" D:\Backup\rename.bat How to make the rename.bat WAIT all process before execute?...

Difference between use of %%A and %A% [duplicate]

windows,batch-file,command-line,dos
This question already has an answer here: What is the difference between % and %% in a cmd file? 2 answers I have the following script: FOR /F "tokens=1-4" %%A IN ("REG QUERY HKCU\Environment\") DO ( ECHO %%A ) However if we change ECHO %%A to: ECHO %A% The...

Responding to Multiple Command Line Prompts

command,exe,dos
I have an exe that runs though Windows Console and prompts for responses for three questions. I created a batch file to contain criteria and would like to automate all three responses to the questions so selecting the bat file runs the data within the batch file. I need to...

Resize down-scale images only modified today

batch-file,dos,mogrify
I'm trying to get the following command to work on Server 2003 using an ImageMagik tool called mogrify. for %G in (.jpg, .png, .gif) do forfiles /p "C:\Images" /s /m *%G -d 0 -c "cmd /c C:\ImageMagick\mogrify.exe -resize 800x800^> -quality 80 -strip @path" But when the mogrify tool runs for...

Destination Folder Batch file

batch-file,dos
I currently use a .bat file I'm able to copy a test.cfg file in a folder named testVersion434 using copy test.cfg testVersion434. Unfortunately I am unable to copy the file test.cfg to a folder that begins with testXXXXXXXX I'll have in the future Folders testVersion43x that will create , and...

How to create `DOS/Unix` Like GUI

c++,c,unix,user-interface,dos
Assuming C/C++, I am wondering what kind of libraries should be used to create a DOS/Linux type of GUI? Please see the photos below (I do not know what is the official name of such a GUI as I never had to create one, but now I have to!). I...

How to read xml value via cmd / Powershell

xml,windows,powershell,cmd,dos
I have the following xml format How can I read the value of Tar Path <?xml version="1.0" encoding="utf-8"?> <Foo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Bar Path="c:\program files\bar" /> <Tar Path="c:\program files\tar" Include="All" /> <Updates></Updates> </Foo> In this example I need to receive the value: c:\program files\tar EDIT Following Alex' comment, It is also...

Batch for each line in directory with spaces

batch-file,dos,spaces
I'm trying to create a batch file that compresses all folders within the main folder to individual zip files with the same name as the subfolders. Example folder structure: So in the main folder, zips need to appear with the exact same name and contents as the subfolders. The code...

Run maven tests in a DOS batch file

maven,batch-file,dos
I am new to scripting. Basically I want to run maven tests and then execute other commands once they're finished (e.g. Write a message to a file, or email the results to myself, etc. For simplicity, let's say I just want to write DONE to "C:/results" file in this case)....

Grunt/Batch : how to execute shell commands within the gruntfile.js directory?

windows,gruntjs,dos,grunt-shell
I know this is a common question but all answers I tried didn't work. What's strange is that a friend tried this script on his Windows and actually got the current directory (the one containing the gruntfile.js). I tried to see the differences but I also didn't find any. module.exports...

Command Line: Using a for loop to create directories with increasing names

batch-file,for-loop,cmd,dos,mkdir
I am trying to write a batch file that does the following: Prompt user for the directory to create the new folder newest Prompt user for an integer limit Create directory newest CD newest FOR loop for limit iterations Create directory "Month " + iteration For example: newest = Reports...

Fastest way to count lines in a file

batch-file,dos
I have huge CSV file, which I want to know the total number of rows in which. Currently I am using something like this, which works perfectly, but it's slow: FIND /c ";" FILENAME.csv But I dunno if that's the fastest way to iterate through all lines in a CSV....

DOS command find space in filename starting from right

batch-file,dos
Is there a command that will return the position of a the first space found in a filename starting from the right? Example: "my filename.txt" would return 13 "my file name.txt" would return 9 Thanks...

DOS Batch multicore affinity not working

python,batch-file,cmd,dos,affinity
I have a batch that launches a few executables .exe and .py (python) to process some data. With start /affinity X mybatch.bat it will work as it should only if X equals to 0, 2, 4 or 8 (the individual cores) But if I will use a multicore X like...

How do I make findstr show the full file path inline?

command-line,path,grep,dos,findstr
When I use grep I get a list of matching results with the full file path for all the child subdirectories. When i do this with findstr - I don't get the inline results. My question is: How do I make findstr show the full file path inline?...

Using FINDSTR to search for a pattern and assign it to a variable

batch-file,command-line,command,dos
I have the following entry in the file Build.aip. I need to write a batch file that searches for "PackageFileName and prints the value assigned for that in the file. In this case, I need to print MyPackageName on the console: <ROW BuildKey="DefaultBuild" BuildName="DefaultBuild" BuildOrder="1" BuildType="0" PackageFolder="C:\Build\Build.aip" PackageFileName="MyPackageName" Languages="en" InstallationType="4">...

How to generate reports for every 100 files using Batch Scipt

batch-file,cmd,dos,beyondcompare
Here's the scenario, for example I have list of files listed in pairing.txt. Now I am doing comparison for all the files listed then generating reports. Now, I want to have a feature that will enable the user how many files he want for one report. For example, I have...

How can I change the directory that “cd \” goes to in git?

windows,dos
When I enter cd \ git goes into a different directory than I would like to. How can I change it so that cd \ takes me to C:\Users\J P\Dropbox\Git Bash ...

want command lines .bat to search in all files in c:\ and if exist virus.bat deleted and do some code ELSE do another

windows,batch-file,command-line,dos
want command lines .bat to search in all files in c:\ and if exist virus.bat Del virus.bat set /a viruses=%viruses%+1 cls echo Yoy are infected! The infected files ware deleted !! pause goto Start ELSE cls echo Your computer is clean! pause goto Start i look in many web sites...

Simple DOS Batch In For Loop Not Working

batch-file,for-loop,dos
My goal is to convert some files with *.cdr extension to *.ai in a directory. The files look like file_a.cdr. file_b.cdr ...... I have replaced the convert.exe for you to another simple command like copy, so don't ask about the sense here in my example. setlocal enableDelayedExpansion for %%f in...

How do I kill a specific process running in the background in DOS?

windows,batch-file,background,dos,kill
Assuming this is a Windows 7 machine - and we're talking about batch scripts on the DOS command line. Imagine I want to start and stop two different processes running in the background, and run things whilst they running in the background. For example: START /B CMD /C tomcatA.bat doSomeStuff...

batch file to create a numbered list and print to text

batch-file,cmd,dos
How can I have a batch file that will ask Name: Then print that name to a text file 1 - 150 times depending on the amount of times I'd like the name printed to a text file in order: Ex. Name: Number of Times: Printing to text file Mike...

IPTables hex string match to mitigate dos attack

debian,dos,iptables,ddos
A server of mine has been under dos attacks for the past few weeks. They've just now starting randomizing the source so I can't simply drop the packets by source IP anymore. Here are a few of the packets from tcpdump: 23:58:32.229878 IP (tos 0x0, ttl 242, id 21915, offset...

ASCIIZ string ending with a zero byte

string,assembly,x86,dos
I was writing an Assembly level program to create a file. .model small .data Fn db "test" .code mov ax,@data mov ds,ax mov CX,00 lea DX,Fn mov ah,3ch int 21h Mov ah,4ch Into 21h End Although program had no errors, but file was not created, so I searched the internet...

Batch file that will print all files (.pdf's and .docs) in a directory

windows,batch-file,pdf,printing,dos
Running Win7, I need a batch file that will print all .doc and .pdf files in a particular directory. Any help greatly appreciated!

How do you escape a double-colon in a DOS batch file?

batch-file,escaping,dos
I need to run a command in a DOS batch file that contains a double colon AND set the output to a variable. Like this set /a TDR = C:\InCharge\CONSOLE\smarts\bin\dmctl -s SSA-SAM invoke SM_System::SM-System nameToAddr %SM_OBJ_InstanceName% I keep getting "Missing operator". I assume that is due to those double-colons. How...

Unclear behavior DOS application's function

dos,reverse-engineering,pascal,ida,disassembler
I'm trying to reverse some DOS application. It's uses *.VAR file like database (perhaps encoding this file). That's application looks like system for testing students. The application shows random questions from the DB-file and get your answer. In this place programm read VAR-file length, then open the file and assign...

DOS Batch script return code not being returned to caller

batch-file,error-handling,dos
We have a file1.cmd calling file2.cmd calling file3.cmd. file3.cmd returns a failure as: exit /b 1 But in file2.cmd we seem to "lose" this failure code. The %ERRORLEVEL% variable is being listed as 0 instead of 1. Any ideas?...

Batch file - Deleting files with a name matching this regex OR that regex but NOT that one

regex,windows,batch-file,dos
I try to write a Windows batch file to delete all files in a directory matching ((regex1 or regex2) and not regex3). I'm able to delete files matching a regular expression using something like: for /f "tokens=*" %%a in ( 'dir /a-d /b *.* ^| findstr /r /c:"^test[0-9]*.jar$"' ) do...

How to remove a single character from the filename of a list of files in a folder using DOS command?

dos
I have a list of files like these: icone1.gif icone2.gif icone1.gif icone11.gif icone12.gif icone13.gif icone14.gif icone15.gif I want to remove 'e' from it so they will icon1.gif, icon2.gif and so on... I tried this from the DOS Command Prompt: ren icone*.gif icon*.gif Didn't work....