Search found 250 matches

by T3RRY
20 Nov 2024 02:42
Forum: DOS Batch Forum
Topic: The Daily Calendar Puzzle
Replies: 3
Views: 1087

Re: The Daily Calendar Puzzle

Very interesting. My first thought, just as a result if how similar the pieces are to tetriminos, is to make a tetris varient that plays out games until a solution is found. I'm sure there's probably some rules that could be applied to generating piece ordering to make solving faster. If I remember ...
by T3RRY
27 Jul 2024 08:42
Forum: DOS Batch Forum
Topic: AutoMacro - a function for Macro code generation
Replies: 0
Views: 27594

AutoMacro - a function for Macro code generation

After encountering a similar function earlier this week on SS64, and liking the apeal of improved readability without using %\n%, I decided the idea could be expanded on to provide new functionality. Ideas that got incorperated along the way: * Switches to add common use structures to macro definiti...
by T3RRY
16 Jul 2024 03:25
Forum: DOS Batch Forum
Topic: Progress bar
Replies: 6
Views: 24479

Re: Progress bar

Nice. Since your using escape sequences, there is another Sequence thats handy for filling space like this - ESC[nX ; where n is the number of spaces to be filled, IE the length of the prograss bar example (the macros are just a convenient way to animate it): @Echo off & Setlocal EnableDelayedExpans...
by T3RRY
05 Jul 2024 04:34
Forum: DOS Batch Forum
Topic: is there a way to use ECHO <esc>[32;40m without adding an extra line?
Replies: 4
Views: 25143

Re: is there a way to use ECHO <esc>[32;40m without adding an extra line?

nnnmmm wrote:
05 Jul 2024 03:04

Code: Select all

ECHO [32;40m
ECHO =================
ECHO Quake 4 - selector
ECHO =================
this is what i want but WITHOUT adding a line

Code: Select all

<nul Set /P "=[32;40m"
ECHO =================
ECHO Quake 4 - selector
ECHO =================
One simple solution
by T3RRY
05 Jul 2024 01:15
Forum: DOS Batch Forum
Topic: How to output a range of lines from a text file using findstr
Replies: 5
Views: 24709

Re: How to output a range of lines from a text file using findstr

Some interesting Approaches here, but it seems to me it would be simpler to parse the output of findstr with the /V switch and perform conditional checks on the first token token to determine if the line corresponds to the desired ranges - unless the intent is specifically to to support Regex expres...
by T3RRY
21 May 2024 11:35
Forum: DOS Batch Forum
Topic: IF Evaluation Values Are ECHO-Suppressed When Beginning With Colon ":". Why?
Replies: 7
Views: 12787

Re: IF Evaluation Values Are ECHO-Suppressed When Beginning With Colon ":". Why?

Each leading-colon-equation token is echo-suppressed in a nested IF too: C:\Test>FOR %$ in ($)do IF :0 == :0 IF :0 == false ECHO C:\Test>IF IF ECHO Reviewing the command parsing behaviour as described on this forum and Stackoverflow, I believe Jeb is bang on the money with regards to the behaviour ...
by T3RRY
18 May 2024 06:39
Forum: DOS Batch Forum
Topic: IF Evaluation Values Are ECHO-Suppressed When Beginning With Colon ":". Why?
Replies: 7
Views: 12787

Re: IF Evaluation Values Are ECHO-Suppressed When Beginning With Colon ":". Why?

Nothing to add on the why, but another finding to add

Using CMD /c to conduct the If operation will show the full command

for testing from the command line:

Code: Select all

@For %G in (":0" "0" "0:")Do cmd /c if %~G==%~G echo [%~G==%~G true]
@For %G in (":0" "0" "0:")Do if %~G==%~G echo [%~G==%~G true]
by T3RRY
11 Feb 2024 13:44
Forum: DOS Batch Forum
Topic: Macro for Dummies
Replies: 16
Views: 39698

Re: Macro for Dummies

for /f %%! in ("! ^! ^^^!") Why is there a '^' before the second '!' in the %%! definition above? I've run lots of tests without that '^', and never had any problem with that: for /f %%! in ("! ! ^^^!") because the behavior differs marginally. ultimately though, ts a preference to convery the purpo...
by T3RRY
10 Feb 2024 23:12
Forum: DOS Batch Forum
Topic: Macro for Dummies
Replies: 16
Views: 39698

Re: Macro for Dummies

Steffen has answered well here the basics, with one minor ommission The newline variable used for multiline definitions only works within parenthesised codeblocks A simple example @Echo off (Set $\n=^^^ %= DO NOT MODIFY $\n Newline variable definition =%) Set example1=Echo Hello World 1 %$\n% Pause ...
by T3RRY
10 Feb 2024 00:27
Forum: DOS Batch Forum
Topic: Macro for Dummies
Replies: 16
Views: 39698

Macro for Dummies

As requested by @miskox at https://www.dostips.com/forum/viewtopic.php?f=3&t=10983#p69429 As remarked within the code, this template is intended to make it easy to create macro's that take arguments The template does nothing with the arguments other than splitting them and returning them in an array...
by T3RRY
18 Jan 2024 16:00
Forum: DOS Batch Forum
Topic: How to copy a txt file into multiple txt files in a destination folder
Replies: 3
Views: 10065

Re: How to copy a txt file into multiple txt files in a destination folder

Hello All, I tried copying the content of a txt file into multiple txt files in a destination folder but not getting the expected result. I've tried : "Copy my file.txt floder\×.txt" but it's not updating all the txt files. Can someone help me out? why would you expect it to? Copy cannot append to ...
by T3RRY
18 Jan 2024 12:39
Forum: DOS Batch Forum
Topic: infinite loop with break condition
Replies: 75
Views: 159869

Re: infinite loop with break condition

Use substring substitution to replace the break variable for each additional while IE \b1 for the first break, \b2 for the second and so on I understand the advantage of generating unique break variable names for each loop. But I don't understand which substring substitution would allow to do that....
by T3RRY
18 Jan 2024 08:31
Forum: DOS Batch Forum
Topic: infinite loop with break condition
Replies: 75
Views: 159869

Re: infinite loop with break condition

(By analogy with WEND, I renamed yesterday's ENDREP as REND.) Particularly in the situation of defining multiple Whiles into a macro, there's a simple alternative to WEND Use substring substitution to replace the break variable for each additional while IE \b1 for the first break, \b2 for the secon...
by T3RRY
18 Jan 2024 07:55
Forum: DOS Batch Forum
Topic: Faster batch macros
Replies: 17
Views: 31927

Re: Faster batch macros

Arthur Clarke once said that perfection was reached, not when you can't add anything anymore to your system, but when you can't remove anything from it without it stopping functionning. I think you may have reached perfection here. Couldn't agree more. Not only is it the most concise, it's the most...
by T3RRY
12 Jan 2024 00:00
Forum: DOS Batch Forum
Topic: Faster batch macros
Replies: 17
Views: 31927

Re: Faster batch macros

This is cool. Thought of a fun way to do it, though haven't tested it inside a macro or anything. This way the 2 FOR loops aren't needed, though the string is much longer. @ECHO ON SETLOCAL ENABLEDELAYEDEXPANSION SET "v=1" FOR /F "tokens=2-7" %%1 in ("!! SET REM ENABLEDELAYEDEXPANSION END REM LOCAL...