Search found 193 matches

by siberia-man
27 Oct 2021 03:45
Forum: DOS Batch Forum
Topic: Attention: Aacini Re: Resistor color calculator
Replies: 8
Views: 1038

Re: Attention: Aacini Re: Resistor color calculator

@Gerhard, @Aacini I've been interested in the challenge you both involved. I read two links: https://www.allaboutcircuits.com/tools/resistor-color-code-calculator/ https://www.allaboutcircuits.com/textbook/reference/chpt-2/resistor-color-codes/ and found some discrepancy between those two. From the ...
by siberia-man
25 Oct 2021 20:22
Forum: DOS Batch Forum
Topic: js/vbs/html/hta and more hybrids and chimeras in cmd/bat
Replies: 64
Views: 192681

Re: js/vbs/html/hta and more hybrids and chimeras in cmd/bat

wsf, js: cosmetic changes improve command line option processing vbs: /w for creating vbs+wsf+bat alternative ps1: shorten chimera for powershell The latest version is here https://github.com/ildar-shaimordanov/cmd.scripts/blob/master/cmdize.bat :: USAGE :: cmdize name [...] :: :: This tool converts...
by siberia-man
25 Oct 2021 09:34
Forum: DOS Batch Forum
Topic: Download files with certutil -urlcache
Replies: 3
Views: 761

Re: Download files with certutil -urlcache

Hmm... I recalled that I've seen this thread time ago. About certutil -urlcache I found the only story in Russian that it's identified by Windows Defender as a trojan. Original text and translated from Russian: Злоумышленники любят использовать встроенные функции ОС для загрузки необходимых файлов н...
by siberia-man
25 Oct 2021 03:10
Forum: DOS Batch Forum
Topic: Download files with certutil -urlcache
Replies: 3
Views: 761

Download files with certutil -urlcache

Today accidentally I knew about the command that acts as a downloader: certutil -urlcache -split -f URL FILE Reading documentation doesn't make its understanding clearer. I slightly played with the command and found that the "-split" option is not necessary and downloading works fine as well: certut...
by siberia-man
23 Oct 2021 03:28
Forum: DOS Batch Forum
Topic: Detect echo state without temporary file
Replies: 14
Views: 7553

Re: Detect echo state without temporary file

One more stuff I think is important. What if the file or directory matching the "?" pattern exists with no access to regular user? For example, the file or directory is owned by another user. I played around with files owned by Administrator. The command replace /u /w works fine in this case as well.
by siberia-man
21 Oct 2021 17:13
Forum: DOS Batch Forum
Topic: Detect echo state without temporary file
Replies: 14
Views: 7553

Re: Detect echo state without temporary file

Honestly, not everything is clear for me here. The solution is extremely tricky. But one thing I found seems a bit buggy and requires to be fixed: the replace command use. It works fine until any file named as one character appears. No one-character named file C:\Temp>dir /b ? C:\Temp>replace /w ? ....
by siberia-man
18 Oct 2021 03:47
Forum: DOS Batch Forum
Topic: Script to detect type (encoding) of files
Replies: 16
Views: 5410

Re: Script to detect type (encoding) of files

I tested TYPE on some examples like: type example-utf8-without-bom.txt | hexdump -C It showed the correct sequence cf 80 . I know it's not complete proof. Probably something like setlocal enabledelayedexpansion & findstr /r "[U+0080-U+10FFFF]" in pseudo-code could help us but I am not sure. And I'm ...
by siberia-man
18 Oct 2021 01:55
Forum: DOS Batch Forum
Topic: Script to detect type (encoding) of files
Replies: 16
Views: 5410

Re: Script to detect type (encoding) of files

My earliest thought was to use FINDSTR. But it has the very important "Character limits for command line search strings" described here: https://ss64.com/nt/findstr-escapes.html. I tried to play with the recommendation given there with no any success. I tried with FINDSTR /r "RE" FILENAME or TYPE FI...
by siberia-man
17 Oct 2021 14:10
Forum: DOS Batch Forum
Topic: Script to detect type (encoding) of files
Replies: 16
Views: 5410

Re: Script to detect type (encoding) of files

aGerman wrote:
17 Oct 2021 13:26
I remarked the main differences:
Sorry. I didn't notice that.
by siberia-man
17 Oct 2021 13:06
Forum: DOS Batch Forum
Topic: Script to detect type (encoding) of files
Replies: 16
Views: 5410

Re: Script to detect type (encoding) of files

Hi Steffen

I guess, it doesn't work properly. I replaced the second line

Code: Select all

set "file=u8nobom.txt"
with

Code: Select all

set "file=%~f0"
and it returned
is UTF-8
Press any key to continue . . .
And it's slower than my script. I'm afraid we won't get any advantage with the branchless-utf8 technique.
by siberia-man
16 Oct 2021 07:23
Forum: DOS Batch Forum
Topic: Script to detect type (encoding) of files
Replies: 16
Views: 5410

Re: Script to detect type (encoding) of files

Hi Steffen,

Thank you for the hint and link to the code. Also I found the full explanation here https://nullprogram.com/blog/2017/10/06/. It's really impressive work. I am going to meditate on this.
by siberia-man
15 Oct 2021 13:43
Forum: DOS Batch Forum
Topic: Script to detect type (encoding) of files
Replies: 16
Views: 5410

Re: Script to detect type (encoding) of files

One more error I've just found and fixed. Some variables were named as bom_val_*, whereas they must be named as enc_val_*. Quite silly mistake.
by siberia-man
15 Oct 2021 12:58
Forum: DOS Batch Forum
Topic: Script to detect type (encoding) of files
Replies: 16
Views: 5410

Re: Script to detect type (encoding) of files

why is there 2 "/f" s in the for Loop
Misprint. But it works. However need to be fixed.

updated
Thank you for thorough code review. I fixed in repo and here.
by siberia-man
15 Oct 2021 12:11
Forum: DOS Batch Forum
Topic: Script to detect type (encoding) of files
Replies: 16
Views: 5410

Script to detect type (encoding) of files

Few days ago I decided to practice in insane programming and wrote the script. It's based on the idea I found in the answer on StackOverflow I guess given by our colleague npocmaka_ . I extended his idea and enabled encoding detection for files with and without BOM. Also the script doesn't fail on e...
by siberia-man
11 Oct 2021 12:27
Forum: DOS Batch Forum
Topic: js/vbs/html/hta and more hybrids and chimeras in cmd/bat
Replies: 64
Views: 192681

Re: js/vbs/html/hta and more hybrids and chimeras in cmd/bat

Few days ago I accepted the PR titled as "Specify "find" command": Users (like me) who have UNIX tools in their PATH variable might call a different find.exe which will break this script. Therefore prepending "%SYSTEMROOT%\System32" makes the call to find.exe unambiguous. This action inspired me for...