Search found 147 matches
- 16 Jan 2012 00:55
- Forum: DOS Batch Forum
- Topic: Batch command execution times
- Replies: 2
- Views: 4764
Batch command execution times
I have recently done a test with a script that I have written. It "interpret strings and acts in response" (see my thread a few pages ago) and I did a test with it to see how fast it ran. I got it to echo the time (echo %time%) and then echo "Hello" 100 times. It then echoed the ...
- 15 Jan 2012 23:32
- Forum: DOS Batch Forum
- Topic: Findstr to read user-defined line from a "for" loop
- Replies: 2
- Views: 7111
Re: Findstr to read user-defined line from a "for" loop
I sincerely apologize to both Squashman and dbenham for my poor conduct on this forum. I did not test your code enough dbenham which I have now found out works exactly as I needed it to. I honestly am sorry to you both and I hope that we can get past this.
Apologies,
Rileyh
Apologies,
Rileyh
- 15 Jan 2012 01:29
- Forum: DOS Batch Forum
- Topic: Findstr to read user-defined line from a "for" loop
- Replies: 2
- Views: 7111
Findstr to read user-defined line from a "for" loop
SCENARIO: (in test.txt) (empty line) printline Hello World (empty line) (in my current batch file) @echo off setlocal enabledelayedexpansion :loop set "$file=test.txt" for /f "tokens=1-2*" %%a in ('findstr /b /i "printline" "!$file!"') do ( set command=%%a set...
- 12 Jan 2012 00:33
- Forum: DOS Batch Forum
- Topic: Specify which line to read in "Findstr"
- Replies: 4
- Views: 9344
Re: Specify which line to read in "Findstr"
Example input: (In test.txt) (something random) printline Hello World (something random) I want it to look on a line number previously specified, so for the sake of this scenario I will make the line number be line 1 and check for "printline" on it (in this case the first line does not hav...
- 08 Jan 2012 05:11
- Forum: DOS Batch Forum
- Topic: "For" string needs to process only one line
- Replies: 5
- Views: 8703
Re: "For" string needs to process only one line
Aacini, Let's do some clarifications: - If you want to process the first line of test.txt file, you may do it this way: set /P firstLine=< "%$file%" For example: for /F "tokens=1*" %%a in ("%firstline%") do ( ... Is it possible to extend that to a number previously set?...
- 08 Jan 2012 04:08
- Forum: DOS Batch Forum
- Topic: Specify which line to read in "Findstr"
- Replies: 4
- Views: 9344
Re: Specify which line to read in "Findstr"
Unfortuantely none of them worked. The console was blank and I could type stuff but nothing happened.
I am currently testing, but I don't know why (so far).
Regards,
Rileyh
I am currently testing, but I don't know why (so far).
Regards,
Rileyh
- 06 Jan 2012 22:13
- Forum: DOS Batch Forum
- Topic: Specify which line to read in "Findstr"
- Replies: 4
- Views: 9344
Specify which line to read in "Findstr"
I have a "for /f" string: @echo off set "$file=test.txt" for /f "tokens=1*" %%a in ('findstr /v /i "printline" "%$file%"') do ( set "command=%%a" set "value=%%b" setlocal enabledelayedexpansion echo !value! endlocal goto :break ) ...
- 02 Jan 2012 03:58
- Forum: DOS Batch Forum
- Topic: "For" string needs to process only one line
- Replies: 5
- Views: 8703
Re: "For" string needs to process only one line
Unfortunately this didn't work as I wanted it to. It builds correctly, but it "picks out" the string, rather than breaking the "for /f" loop if it is unsuccessful on the first line. By the way, how can I get it to read each line successively. E.g. :loop find /c /i "(string)&...
- 01 Jan 2012 02:33
- Forum: DOS Batch Forum
- Topic: infinite loop with break condition
- Replies: 75
- Views: 159065
Re: infinite loop with break condition
The simplest way that I have found to do it is this: set "n=0" :loop set /a n+=1 if /i _"%n%"==_"10" (goto :exitloop) ping -n 10 1.1.1.1 goto :loop :exitloop exit /b Why (and how!) do you use macros to do infinite loops? And <b>aGerman</b>'s original topic post, it is n...
- 01 Jan 2012 02:24
- Forum: DOS Batch Forum
- Topic: how to timeout on xp
- Replies: 3
- Views: 9224
Re: how to timeout on xp
Thank you <b>Squashman</b>, this has been helpful.
- 01 Jan 2012 02:23
- Forum: DOS Batch Forum
- Topic: "For" string needs to process only one line
- Replies: 5
- Views: 8703
"For" string needs to process only one line
I have a for string: REM Printline: REM Standard printline: set "$file=test.txt" for /f "tokens=1*" %%a in ('findstr /b /i "printline" "!$file!"') do ( set "command=%%a" set "value=%%b" echo !value! goto :break ) :break I need it to process...
- 01 Jan 2012 00:42
- Forum: DOS Batch Forum
- Topic: how to timeout on xp
- Replies: 3
- Views: 9224
how to timeout on xp
I have recently needed to change from windows 7 to windows xp and I have come to the shocking realisation that there is no timeout command. So how can do something of the equivalent? Is there a method that does the same thing?
Regards,
Rileyh
Regards,
Rileyh
- 17 Dec 2011 04:55
- Forum: DOS Batch Forum
- Topic: Error with conditional command use
- Replies: 1
- Views: 3160
Error with conditional command use
I am trying to make a command called "stop /message=(something)" and it is supposed to do the same thing as this: pause >nul echo (something) where it would appear as though instead of "press any key to continue" it has said the (something). But in my code: :break REM Stop: REM S...
- 08 Dec 2011 01:48
- Forum: DOS Batch Forum
- Topic: "For /f" string needs to run only once
- Replies: 6
- Views: 7249
"For /f" string needs to run only once
Hi guys, I have a "for /f" string: @echo off setlocal enabledelayedexpansion set "$match=(values here vary)" set "$file=test.txt" for /f "tokens=1-2*" %%a in ('findstr /b /i "!$match!" "!$file!"') do ( ) set "b=%%a" set "rest...
- 04 Dec 2011 03:48
- Forum: DOS Batch Forum
- Topic: The final decider-Linux/Unix or Windows
- Replies: 8
- Views: 11490
Re: The final decider-Linux/Unix or Windows
TO ALL WOULD-BE VOTERS: THE POLL DOES NOT WORK, JUST POST A REPLY AND STATE YOUR VOTE