Search found 147 matches

by Rileyh
16 Jan 2012 00:55
Forum: DOS Batch Forum
Topic: Batch command execution times
Replies: 2
Views: 2126

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 ...
by Rileyh
15 Jan 2012 23:32
Forum: DOS Batch Forum
Topic: Findstr to read user-defined line from a "for" loop
Replies: 2
Views: 3897

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
by Rileyh
15 Jan 2012 01:29
Forum: DOS Batch Forum
Topic: Findstr to read user-defined line from a "for" loop
Replies: 2
Views: 3897

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...
by Rileyh
12 Jan 2012 00:33
Forum: DOS Batch Forum
Topic: Specify which line to read in "Findstr"
Replies: 4
Views: 4891

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...
by Rileyh
08 Jan 2012 05:11
Forum: DOS Batch Forum
Topic: "For" string needs to process only one line
Replies: 5
Views: 3788

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?...
by Rileyh
08 Jan 2012 04:08
Forum: DOS Batch Forum
Topic: Specify which line to read in "Findstr"
Replies: 4
Views: 4891

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
by Rileyh
06 Jan 2012 22:13
Forum: DOS Batch Forum
Topic: Specify which line to read in "Findstr"
Replies: 4
Views: 4891

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 ) ...
by Rileyh
02 Jan 2012 03:58
Forum: DOS Batch Forum
Topic: "For" string needs to process only one line
Replies: 5
Views: 3788

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)&...
by Rileyh
01 Jan 2012 02:33
Forum: DOS Batch Forum
Topic: infinite loop with break condition
Replies: 32
Views: 27956

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...
by Rileyh
01 Jan 2012 02:24
Forum: DOS Batch Forum
Topic: how to timeout on xp
Replies: 3
Views: 4434

Re: how to timeout on xp

Thank you <b>Squashman</b>, this has been helpful.
by Rileyh
01 Jan 2012 02:23
Forum: DOS Batch Forum
Topic: "For" string needs to process only one line
Replies: 5
Views: 3788

"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...
by Rileyh
01 Jan 2012 00:42
Forum: DOS Batch Forum
Topic: how to timeout on xp
Replies: 3
Views: 4434

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
by Rileyh
17 Dec 2011 04:55
Forum: DOS Batch Forum
Topic: Error with conditional command use
Replies: 1
Views: 1393

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...
by Rileyh
08 Dec 2011 01:48
Forum: DOS Batch Forum
Topic: "For /f" string needs to run only once
Replies: 6
Views: 2975

"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...
by Rileyh
04 Dec 2011 03:48
Forum: DOS Batch Forum
Topic: The final decider-Linux/Unix or Windows
Replies: 8
Views: 4687

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