Search found 93 matches

by sst
06 Feb 2022 03:07
Forum: DOS Batch Forum
Topic: Difference .BAT / .CMD?
Replies: 4
Views: 4202

Re: Difference .BAT / .CMD?

(and thanks for that quick date %date% admin-check too) I don't want start a discussion about date %date%, especially here in this topic since it's about something else. But I'm against promoting bad and potentially dangerous practices, no matter how they seems to be clever or convenient to use. Us...
by sst
03 Feb 2022 20:52
Forum: DOS Batch Forum
Topic: Variable nesting, odd behavior maybe useful. Update: not new, already handled at DosTips
Replies: 6
Views: 4675

Re: Variable nesting, odd behavior maybe useful

This is a known behavior, which was first described by Dave in SETLOCAL continues after batch termination! about 11 years ago. Yes it's extremely hard to find even when one knows about it. So basically, because of the syntax error, your setlocal enableDelayedExpansion remains in effect after the bat...
by sst
02 Feb 2022 07:55
Forum: DOS Batch Forum
Topic: Difference .BAT / .CMD?
Replies: 4
Views: 4202

Re: Difference .BAT / .CMD?

The differences between .CMD and .BAT as far as CMD.EXE is concerned are: With extensions enabled, PATH/APPEND/PROMPT/SET/ASSOC in .CMD files will set ERRORLEVEL regardless of error. .BAT sets ERRORLEVEL only on errors. ( link ) And Here is the link to the original statement by Mark Zbikowski
by sst
26 Jan 2022 16:29
Forum: DOS Batch Forum
Topic: The fastest way to detect internal IP address
Replies: 8
Views: 7402

Re: The fastest way to detect internal IP address

My concern is about whether the next commands give the same result or not. netstat -rn | findstr "\<0.0.0.0\>" route print 0.0.0.0 | findstr "\<0.0.0.0\>" The routing table is the same regardless of the program that used to retrieve the table. There could be difference in the presentation layer, bu...
by sst
21 Jan 2022 23:21
Forum: DOS Batch Forum
Topic: genDenoCmdLineHelp.cmd - One-click complete command line help generator for Deno
Replies: 0
Views: 35648

genDenoCmdLineHelp.cmd - One-click complete command line help generator for Deno

genDenoCmdLineHelp.cmd A one-click utility batch file to generate complete command line help documentation including SubCommands for Deno (https://deno.land) It should work for future versions of Deno with new and/or removed SubCommands. The generated documentation text file will be placed in the sa...
by sst
22 Nov 2020 16:42
Forum: DOS Batch Forum
Topic: Detecting and removing TABs from a string without prior access to the TAB character
Replies: 14
Views: 12497

Re: Detecting and removing TABs from a string without prior access to the TAB character

Here is an interactive version of the script with the applied suggestion by Eureka! Please note that SET /P strips the trailing TABs from user input. So the case for trailing TABs can not be tested with this interactive version. (At least that's the case on my Win7 x64) EDIT: Trailing TABs can be te...
by sst
22 Nov 2020 16:09
Forum: DOS Batch Forum
Topic: Detecting and removing TABs from a string without prior access to the TAB character
Replies: 14
Views: 12497

Re: Detecting and removing TABs from a string without prior access to the TAB character

Unfortunately this one doesn't work as it is, if the first part of the string contains = or ! The case for ! can be resolved easily, but = is tough. As a side note you should use something like "#%TEMPSTRING%#" in FOR /F to protect the leading and trailing TABs. The reason for protecting the leading...
by sst
22 Nov 2020 14:15
Forum: DOS Batch Forum
Topic: Detecting and removing TABs from a string without prior access to the TAB character
Replies: 14
Views: 12497

Re: Detecting and removing TABs from a string without prior access to the TAB character

Thanks Eureka!. It is much better now.
Getting rid of :strlen was my primary concern. Now I'm relieved :D
by sst
22 Nov 2020 12:08
Forum: DOS Batch Forum
Topic: Detecting and removing TABs from a string without prior access to the TAB character
Replies: 14
Views: 12497

Re: Detecting and removing TABs from a string without prior access to the TAB character

Nope. I removed spaces as a temporary means of performing the TAB detection and obtaining the TAB character.
My code preserves the spaces while removing/replacing the TABs in the original string. Your's does not.
So it is not only a matter of simplification.
by sst
22 Nov 2020 11:16
Forum: DOS Batch Forum
Topic: Detecting and removing TABs from a string without prior access to the TAB character
Replies: 14
Views: 12497

Re: Detecting and removing TABs from a string without prior access to the TAB character

Based on what I understand this may be an easier solution for you. @echo off setlocal SET "tabstg=Some String with tabs" SET /P "repl=Enter Replacement String or {enter} for none:" :LOOP FOR /F "tokens=1*" %%G IN ("%tabstg%") DO ( IF NOT "%%H"=="" ( SET "tabstg=%%G%repl%%%H" GOTO LOOP ) ) echo Stri...
by sst
22 Nov 2020 11:12
Forum: DOS Batch Forum
Topic: Detecting and removing TABs from a string without prior access to the TAB character
Replies: 14
Views: 12497

Re: Detecting and removing TABs from a string without prior access to the TAB character

I didn't say that. And the spaces are not a problem. But I think It should be obvious by know. Well maybe I don't understand the English Language but you certainly inferred that with your REM comments. :: Remove all Spaces :: ... set "testTAB=#!String: =!#" REM The default delimiters are <SPACE> an...
by sst
22 Nov 2020 06:12
Forum: DOS Batch Forum
Topic: Limited number of CALLs per line?
Replies: 4
Views: 4862

Re: Limited number of CALLs per line?

Adding the one more CALL :SUB to the line causes the last :SUB on the line to be recognized as a valid batch label so the next line will executed in the context of the :SUB function. @echo off call :SUB & call :SUB & call :SUB & call :SUB & call :SUB & call :SUB & call :SUB & call :SUB & call :SUB &...
by sst
22 Nov 2020 03:31
Forum: DOS Batch Forum
Topic: Detecting and removing TABs from a string without prior access to the TAB character
Replies: 14
Views: 12497

Re: Detecting and removing TABs from a string without prior access to the TAB character

But why go through all that extra code to remove the tab by getting the string length. You already have the TAB removed with the FOR /F command. And what if your string has multiple tabs???? FOR /F can not be used to remove the TABs from the string because as you said the string can contain multipl...
by sst
21 Nov 2020 13:49
Forum: DOS Batch Forum
Topic: Detecting and removing TABs from a string without prior access to the TAB character
Replies: 14
Views: 12497

Detecting and removing TABs from a string without prior access to the TAB character

Detecting and/or removing the TAB characters from a string is a fairly simple task, define the TAB character using one of many available methods and do a substitution !string:%TAB%=! But I was looking a way to detect and possibly remove or substitute the TAB characters without resorting to any exter...
by sst
15 Sep 2019 18:14
Forum: DOS Batch Forum
Topic: Closing parenthesis prevents escape of subsequent special character operator
Replies: 33
Views: 36991

Re: Closing parenthesis prevents escape of subsequent special character operator

I'm not sure if you misunderstood what i had written and use a different definition of "different parsers", or if there really are multiple different parsers - both could be what you describe (depending on how you mean it). From my usage of "different parsers", the interpreter would for example has...