Search found 43 matches

by Thor
22 Mar 2018 14:30
Forum: DOS Batch Forum
Topic: Compare Current Date To A Specific Date
Replies: 6
Views: 5189

Re: Compare Current Date To A Specific Date

Try this: @echo off :: assumed date format is "mm/dd/yyyy" for /f "tokens=1-2 delims= " %%A in ("%date%") do ( for /f "tokens=1-3 delims=/" %%x in ("%%B") do ( set "today=%%~z%%~x%%~y" if "%%~z%%~x%%~y" geq "20180501" ( goto :CSharp ) else ( goto :Access ) ) ) exit /b :Access ECHO( ECHO Today is "%t...
by Thor
07 May 2017 17:06
Forum: DOS Batch Forum
Topic: Words with star char are ignored in FOR loop
Replies: 5
Views: 5908

Re: Words with star char are ignored in FOR loop

You could try this also: @echo off &setlocal enableDelayedExpansion set "list=coo*.* ses*.js sign bookmarkbackups\*.json" for /l %%i in (1 1 4) do ( for /f "tokens=1* delims= " %%A in ("!list!") do ( echo %%A set "list=%%B" ) ) endlocal &exit /b
by Thor
06 May 2017 10:08
Forum: DOS Batch Forum
Topic: Return to original bat file
Replies: 4
Views: 4999

Re: Return to original bat file

To be able to return to the 1st batch after finishing the 2nd batch, you need to use the "call" command.
Batch1.bat:

Code: Select all

...
call batch2.bat
rem continue with the rest of batch1 file.
...
by Thor
03 May 2017 11:53
Forum: DOS Batch Forum
Topic: How to extract data from website?
Replies: 33
Views: 26330

Re: How to extract data from website?

PaperTronics wrote:@Thor: Nice coding but it's kind of slow.

Try my code again, it should runs pretty decent now. :D
by Thor
01 May 2017 10:29
Forum: DOS Batch Forum
Topic: How to extract data from website?
Replies: 33
Views: 26330

Re: How to extract data from website?

@echo off setlocal enableDelayedExpansion for /f "tokens=*" %%i in (url.txt) do ( set "line=%%i" for /l %%k in (1 1 20) do ( for /F "tokens=1* delims= " %%A in ("!line!") do ( set "nextToken=%%A" if "!nextToken:~7,17!" == "www.mediafi...
by Thor
20 Apr 2017 08:54
Forum: DOS Batch Forum
Topic: Format a string inside For...Loop
Replies: 4
Views: 4666

Re: Format a string inside For...Loop

SIMMS7400: Thanks for tips of putting double quotes.

penpen and Aacini: Thanks both for your input. Your codes all works fine and as expected.
by Thor
20 Apr 2017 01:22
Forum: DOS Batch Forum
Topic: Format a string inside For...Loop
Replies: 4
Views: 4666

Format a string inside For...Loop

Hi all, I have the following FOR /F Loop and I would like to format the SET command based on a known value of "count" variable. For example, inside the FOR /F Loop: - If count value = 1 the set command will look like: "set c1=%%A" - If count value = 2 the set command will look li...
by Thor
10 Apr 2017 13:59
Forum: DOS Batch Forum
Topic: Speecher | A Pro Text-to-Speech Engine in Batch | By PaperTronics
Replies: 15
Views: 16276

Re: Speecher | A Pro Text-to-Speech Engine in Batch | By PaperTronics

"Twinkle.txt": Twinkle twinkle little star. How I wonder what you are. Up above the world so high, Like a diamond in the sky. Twinkle twinkle little star. How I wonder what you are. Apply aGerman batch/javascript hybrid : "talk.bat" @if (@a)==(@b) @end /* Batch part: @echo off fo...
by Thor
30 Mar 2017 15:56
Forum: DOS Batch Forum
Topic: Using many "tokens=..." in FOR /F command in a simple way
Replies: 59
Views: 81549

Re: Using many "tokens=..." in FOR /F command in a simple way

This is a proof of concept. Handle large set of tokens from 1-10,000 tokens. - Since a For /F loop could not handle file larger than 8191 bytes so in order to accommodate larger token set, I've divided the token set into smaller file chunks which length is not larger than 8191 bytes in size. - Data1...
by Thor
27 Mar 2017 11:20
Forum: DOS Batch Forum
Topic: Processing text files with very large lines via FOR /F command
Replies: 3
Views: 5657

Re: Processing text files with very large lines via FOR /F command

Hi Aacini, I have the following book called "Books.txt" (enclosed) When I run your batch file which I call "book.bat", I've got the following menu: Available books: 1- Book Name 1 2- Book Name 2 3- Book Name 3 Enter book number (4 to add a new book): 1 '/d' is not recognized as a...
by Thor
25 Mar 2017 13:53
Forum: DOS Batch Forum
Topic: Using many "tokens=..." in FOR /F command in a simple way
Replies: 59
Views: 81549

Re: Using many "tokens=..." in FOR /F command in a simple way

Hi Aacini:
I've got it. Thanks for the clarification. :D

Hi dbenham:
I like your new :getTokenValue function add-in.
by Thor
25 Mar 2017 11:00
Forum: DOS Batch Forum
Topic: Using many "tokens=..." in FOR /F command in a simple way
Replies: 59
Views: 81549

Re: Using many "tokens=..." in FOR /F command in a simple way

Hi Aacini,

I've run your "MakeForTokens.bat" with a token of 1342 and I did not see the lines that said:
Token via FOR: {}
...
...
anymore. Do you know why?
by Thor
20 Mar 2017 00:59
Forum: DOS Batch Forum
Topic: Using many "tokens=..." in FOR /F command in a simple way
Replies: 59
Views: 81549

Re: Using many "tokens=..." in FOR /F command in a simple way

I'm almost sure your input line has exceeded the 8191 byte limit. I have successfully tested up to my macro limit of 2303 (I had mistakenly reported 2304, but that last token is reserved for the remainder of the line that is not parsed). But in order to fit that many tokens within a 8191 line lengt...
by Thor
18 Mar 2017 23:14
Forum: DOS Batch Forum
Topic: Using many "tokens=..." in FOR /F command in a simple way
Replies: 59
Views: 81549

Re: Using many "tokens=..." in FOR /F command in a simple way

And here is the finished product Documentation is embedded at the top of :defineFor and :defineForChars I've tested as many as 900 tokens in one line, but this example uses "only" 300. Dave Benham Very nice batch file, I could test up to 1323 tokens correctly. But more than that I could n...
by Thor
18 Mar 2017 17:21
Forum: DOS Batch Forum
Topic: Delayed expansion fails in some cases
Replies: 18
Views: 25646

Re: Delayed expansion fails in some cases

This works, but I don't know why :D

Code: Select all

@echo off
setlocal EnableDelayedExpansion
(set \n=^
%=empty=%
)&receiver.bat "Line1!\n!line2"