HI,
I want to display datas in text file. Here i have Listfile.txt and want to display each line using batch file. How to do this with looping.
Below is my code
for /f "tokens=* delims= " %%a in (Listfile.txt) do (
set /a N+=1
set v!N!=%%a
)
set hostname=!v1!
echo %hostname%
pause
Data in Listfile.txt:
4mLinuxMachine.cpp
Shutd...
Hi,
i want to nest for loop inside batch to delete Carriage return.
I did liek this but not working please help
@echo off
setLocal EnableDelayedExpansion
for /f "tokens=* delims= " %%a in (Listfile.txt) do (
set /a N+=1
set v!N!=%%a
)
for /l %%i in (1, 1, %N%) do (
echo !v%%i!
for /r "tokens=* delims=" %%i in (windows.cpp) do (
ech...
hi
THis is my code
for /l %%i in (1, 1, %N%) do (
echo !v%%i!
for /f "tokens=* delims=" %%l in ("!v%%i!") do (
echo %%l >> Linux.cpp )
)
Here i want to copy data in %%l to linux.cpp file
Now what happening is if %%l contain abc.cpp this name is stored in linux.cpp. Here i want to store contents in abc.cpp to linux.cpp.
Plea...
I am using a batch file to write a vbs email file. I am unable to create the text body of the email which includes the vbCRLF code. When the TextBody is written to the Target file, it has executed the first vbCRLF, and the DOS returns errors as it tries to execute the second vbCRLF and the last string. Enclosing it in doucble quotes does...
What are batch files useful for? They just seem to be used to make viruses and other things...but it seems like shell scripting to me.
Whats the uses for batch files?
...
Hi,
I need to kill a windows process (java.exe). I'm currently using:
taskkill.exe /F /IM java.exe
I need to use the /F option since is a critical process,but in this way I get a return code 1 instead I need a return code 0 (returned when I don't use /F for killing other not critical processes)
how could I fix this problem?
Many tha...
Is it possible using a batch script to change string in a txt file?
For example, I have status.txt, which contains 2 lines:
SingleSite integer1
MultiSite integer2
I want to change them into:
TAG integer1
Engineer integer2
so SingleSite becomes TAG and MultiSite becomes Engineer
...
Suppose I wish to get the absolute path of a batch script from within the batch script itself, but without a trailing backslash.
Normally, I do it this way:
SET BuildDir=%~dp0
SET BuildDir=%BuildDir:~0,-1%
The first statement gets the path with the trailing backslash and the second line removes the last character, i.e. the backslash....
Hello all,
Question 1:
I wanna append a list of filenames with a sequence no. at the back to current date , e.g.
Originally:
ABCDEFG-ALL-18269423.TXT
ABCDEFG-ALL-18269521.TXT
QWERTTY-ALL-18269530.TXT
QWERTTY-ALL-18269600.TXT
Result:
ABCDEFGJul01.TXT
QWERTTYJul01.TXT
(Copy and rename only the file with latest sequence no. to anot...
I need to run a counter and a timer at the same time, but I'm not sure about how to achieve it.
I have a batch file that counts the number of times any key is pressed in an easy loop made by a goto,
once its done (keypress) for the first time, it fires a timer for 1 min;
the key pressed in that time, must be stored in another variable...
Hello All, In the early days of my site, I allowed people to upload any size image they wanted. I now have client and server side config to limit new images to 2000px max, while maintaiing the origional ratio.
So from the old config I have a heap of directories with large images that I need to scale down, I would like to do this on the...
Hello, I'm trying to write a batch file in which I need the HEAD revision of the project I am working on.
Is there a command to get this from the command line?
I am on a Windows XP Machine.
EDIT
I ended up using a mix between Shambulator, mizipzor, and Stefan's answers. I ended up with this:
for /f "tokens=5" %%i in ('SubWCRev Workin...
hi,
i have about 250 files that i need to move to a specific folder.
the problem is that folder only have the partial name of the files.
for example, i need to move file: "12345.txt" to folder "12345 - hello" as each folder starts by the actual file name.
can i do this in a batch file in dos?
thank you.
...
Hello
I want to read registry string value, from bat file, and then assing the readed value to variable.
I tried the following :
FOR %%a in ('REG QUERY HKLM\SOFTWARE\MathWorks\MATLAB\7.10 /v MATLABROOT') DO set MATLAB=%%a
echo %MATLAB%
but it doesn't work.
...
I have a folder structure with one main parent folder containing many subfolders, and in these some PNGs, something like:
.../data
.../data/013523/
.../data/345343/
.../data/395338/
.../data/013523/filex.png
.../data/013523/filey.png
.../data/345343/filea.png
.../data/345343/fileb.png
.../data/345343/filec.png
I'd like to crush all ...
I am trying to create backup script for my ESXi server and I am running in a bit of an issue.
I need to loop these 2 commands and then write them to a text file I call backup.list. It will contain all of the VM IDs and VM names I need to back.
When I have the two loop commands run against the server they only return the last value, I k...
I'm trying to figure out how to add a series of events to a non-default calendar (and remove some) as a batch, but there's no hint of how to do it in Google's frankly awful documentation.
Has anyone cracked this nut or does anyone know where there is actually useful documentation on using the Google Calendar API?
...
I have a file that contains some information about the product I work on. The information I'm specifically interested in is the version of the product.
I need to read in this version and store it in a variable that I can manipulate so I can increment the version number appropriately. I'm trying to use a line like this:
for /f "tokens=2...
Hello all,
I have a batch script that checks if a registry key exists and if it does exist then open Internet explorer. What I now want to do is get the value of that registery key and put it in the URL. How can I do this?
@echo off
reg query HKLM\Software\Test\Monitor\Settings
if errorlevel 1 goto not_exist
goto exist
:not_exist
:ex...
I have the following batch script from Wikipedia:
@echo off
for /R "C:\Users\Admin\Ordner" %%f in (*.flv) do (
echo %%f
)
pause
In the for-loop all files with the extension flv get echoed,
but I want the make some actions with the file(s)
where I need one time the file without the extension and one time with the extension.
How...