Search found 9 matches
- 04 Feb 2022 12:57
- Forum: DOS Batch Forum
- Topic: Limitation in for /r command
- Replies: 5
- Views: 6075
Re: Limitation in for /r command
This generates an interesting error message - unbalanced quotes: @echo off setlocal enableDelayedExpansion set "option=delims=" for /f "!option!" %%A in ("1 2") do echo %%A pause !option!" was unexpected at this time. The error message is the same when delayed expansion is disabled. This proves tha...
- 03 Feb 2022 18:50
- Forum: DOS Batch Forum
- Topic: more tricks with certutil
- Replies: 13
- Views: 46028
Re: more tricks with certutil
CERTUTIL has a surprisingly low limit to the size file it can encode/decode. I'm not sure about the exact value, but the encode limit is only in the tens of millions range. The file size limitation seems not to be bound on the input file but on both input and output files, or to the internal en-/de...
- 15 Jan 2022 08:40
- Forum: DOS Batch Forum
- Topic: Script to detect type (encoding) of files
- Replies: 17
- Views: 18788
Re: Script to detect type (encoding) of files
Hello,
several years ago I wrote a script that can determine whether or not a file is ASCI/ANSI-encoded:
https://stackoverflow.com/a/43147510
several years ago I wrote a script that can determine whether or not a file is ASCI/ANSI-encoded:
https://stackoverflow.com/a/43147510
- 26 Dec 2021 17:29
- Forum: DOS Batch Forum
- Topic: reverse string without goto
- Replies: 10
- Views: 18314
Re: reverse string without goto
Here is a method without first determining the length of the string. It is designed as a function that accepts two arguments: the name of the variabe that receives the resulting string; the name of the variable that contains the original string; @echo off setlocal EnableExtensions DisableDelayedExpa...
- 23 Nov 2020 18:31
- Forum: DOS Batch Forum
- Topic: Comand line and special character
- Replies: 2
- Views: 4090
Re: Comand line and special character
ÿÿÿÿÿ is the relay ID and is the problem whe nusing inside a .BAT file. I bet the character ÿ has got the code 0xFF, which is seen as the non-break space (NBSP) and constitutes a standard token separator, just like: SPACE TAB , ; = VTAB FF . I guess escaping each by ^ like ^ÿ^ÿ^ÿ^ÿ^ÿ is not going t...
- 22 Nov 2020 09:02
- Forum: DOS Batch Forum
- Topic: Limited number of CALLs per line?
- Replies: 4
- Views: 6236
Re: Limited number of CALLs per line?
All can be explained once you understand how CALL/GOTO scan for labels. The label scanner reads until \r\n is found, or 512 bytes, whichever comes first. The code that has no error has the following at line position 1024: <space>:SUB So the label is found, and the routine starts on the next line (a...
- 21 Nov 2020 16:14
- Forum: DOS Batch Forum
- Topic: Alternate method to get TAB, Carriage return and possibly all others
- Replies: 35
- Views: 44251
Re: New Universal method to get TAB, Carriage return and possibly all others
For the get the CR I not found this excellent: for /F %%Z in ('copy /Z "%~dpf0" nul') do set "CR=%%Z" Because it fails if the batch script have the readonly attribute. More details here: https://www.dostips.com/forum/viewtopic.php?f=3&t=4741&start=90#p40757 This is a very interesting finding. Also ...
- 21 Nov 2020 14:51
- Forum: DOS Batch Forum
- Topic: Alternate method to get TAB, Carriage return and possibly all others
- Replies: 35
- Views: 44251
Re: Alternate method to get TAB, Carriage return and possibly all others
Hello, seems nobody has yet mentioned the FORFILES command with its nice 0xHH hex code feature. :idea: I use it for getting the TAB character, but it works for almost all characters except CR and LF: for /F "delims=" %%T in ('forfiles /P "%~dp0." /M "%~nx0" /C "cmd /C echo/0x09"') do set "TAB=%%T" I...
- 21 Nov 2020 14:18
- Forum: DOS Batch Forum
- Topic: Limited number of CALLs per line?
- Replies: 4
- Views: 6236
Limited number of CALLs per line?
Hello, I just encountered a very strange behaviour of the CALL command (on my Windows 7 x64 machine) when it tries to call a non-existent label and appears quite a number of times in a line: :o @echo off ::The following contains 85 times `call :SUB` and complaints about a missing label as expected. ...