Search found 4149 matches

by aGerman
24 Oct 2021 04:21
Forum: DOS Batch Forum
Topic: check for updates option
Replies: 1
Views: 20

Re: check for updates option

The answer to "is this possible" is probably "yes". But there's no general way of how to do it. On an FTP server share you would probably read the file's date directly. On an HTTP(S) server share you certainly have to read and parse the HTML source text. And if the owner decides to update the appear...
by aGerman
24 Oct 2021 04:12
Forum: DOS Batch Forum
Topic: Yesterday
Replies: 1
Views: 13

Re: Yesterday

Yes the :DaysAdd routine is able to calculate this for you. I'm not aware of any command that provides you yesterday's date out of the box. So we have no better possibility than adapting the formulas for Julian Day Numbers of the Gregorian Calendar.

Steffen
by aGerman
23 Oct 2021 07:19
Forum: DOS Batch Forum
Topic: Testing cmd.exe in Windows 11?
Replies: 9
Views: 929

Re: Testing cmd.exe in Windows 11?

The console host now supports double-height and double-width text (... while Windows Terminal does NOT :?). (//EDIT: Based on what I've read in the belonging PR it's not been meant to get implemented into Windows Terminal for performance reasons.) @echo off &setlocal for /f %%i in ('echo prompt $E^|...
by aGerman
19 Oct 2021 13:29
Forum: DOS Batch Forum
Topic: Script to detect type (encoding) of files
Replies: 16
Views: 1136

Re: Script to detect type (encoding) of files

I updated the code once again. It's a little more robust now because it explicitly treats bytes 0x00..0x07 and 0xF8..0xFF being invalid. Besides of that I changed the errorlevel logic to get more information. errorlevel >= 2 -- UTF-8 with multibyte sequences errorlevel == 1 -- All ASCII. This is val...
by aGerman
19 Oct 2021 06:00
Forum: DOS Batch Forum
Topic: Remove empty folders log
Replies: 7
Views: 549

Re: Remove empty folders log

Well, that's crystal ball gazing. I mean, a subfolder of a folder on you desktop is really kind of no information at all. What are the names? Do you know to what the parent folder belongs where the subfolder is created? What if you set the subfolder read-only in its properties? Do you get any messag...
by aGerman
18 Oct 2021 11:15
Forum: DOS Batch Forum
Topic: Script to detect type (encoding) of files
Replies: 16
Views: 1136

Re: Script to detect type (encoding) of files

IIRC at least UTF-16 is converted by the TYPE command.

Steffen
by aGerman
18 Oct 2021 10:55
Forum: DOS Batch Forum
Topic: CONVERTCP.exe - Convert text from one code page to another
Replies: 131
Views: 131387

Re: CONVERTCP.exe - Convert text from one code page to another

Version 8.3 improves the performance of UTF-8 identification. Further I found a way to shrink the binary size by ~20 KB. Virustotal scans of version 8.3: x86: https://www.virustotal.com/gui/file/4d11d1cc3065e40d758794d862cf673a242b0bfd7348d8ed06532bd8fb1a3172 x64: https://www.virustotal.com/gui/file...
by aGerman
18 Oct 2021 02:52
Forum: DOS Batch Forum
Topic: Script to detect type (encoding) of files
Replies: 16
Views: 1136

Re: Script to detect type (encoding) of files

Hmm, I think you actually shouldn't use TYPE. Needs some further investigation, but it seems to me that TYPE already changes the encoding. FINDSTR might be an option to find low order bytes which may indicate binary data. Besides of the limits you mentioned, I think it can't be used to determine UTF...
by aGerman
17 Oct 2021 14:22
Forum: DOS Batch Forum
Topic: Script to detect type (encoding) of files
Replies: 16
Views: 1136

Re: Script to detect type (encoding) of files

No problem, Ildar. Well, actually there's a possibility to use a FOR /L. We need to create another cmd process though. @if "%~1"=="::check::" (goto check) else echo off &setlocal DisableDelayedExpansion set "file=u8nobom.txt" set "me=%~fs0" setlocal EnableDelayedExpansion :: write all hex values in ...
by aGerman
17 Oct 2021 13:26
Forum: DOS Batch Forum
Topic: Script to detect type (encoding) of files
Replies: 16
Views: 1136

Re: Script to detect type (encoding) of files

Hi Ildar, I remarked the main differences: - It checks up to 511 bytes of a file, and it continues as long as it doesn't find an invalid sequence. - It treats ASCII to be valid, since ASCII is indeed valid UTF-8. So, yes, it is absolutely correct that the script code is valid UTF-8. ASCII is a subse...
by aGerman
17 Oct 2021 12:43
Forum: DOS Batch Forum
Topic: Refer to file made by date / time variable
Replies: 6
Views: 409

Re: Refer to file made by date / time variable

E.g. if you want to get a timestamp as name for your file:
timestamp.png
timestamp.png (74.62 KiB) Viewed 387 times
(yellow emphasizing is mine)
And once you know that WMIC is worth doing further investigation, just do it.

Steffen
by aGerman
17 Oct 2021 11:28
Forum: DOS Batch Forum
Topic: Refer to file made by date / time variable
Replies: 6
Views: 409

Re: Refer to file made by date / time variable

drgt wrote:
17 Oct 2021 10:02
I would have never found it...
Do you actually believe that I recall thousands of threads and posts? Guess how I find the topics I link in your threads :wink:

Steffen
by aGerman
17 Oct 2021 09:41
Forum: DOS Batch Forum
Topic: Refer to file made by date / time variable
Replies: 6
Views: 409

Re: Refer to file made by date / time variable

You know, there is a "Search this forum..." field directly on top of the list view of threads ... Obviously you're asking questions before you even tried out anything. Not only that %time% advances, it also contains colons which are not allowed in file names. Use WMIC. The FOR /F loop in this thread...
by aGerman
17 Oct 2021 09:08
Forum: DOS Batch Forum
Topic: Moving Empty Folders
Replies: 9
Views: 522

Re: Moving Empty Folders

Since it is best practice to always quote paths (regardless whether they actually contain spaces or special characters like ampersands), you have to use them along with USEBACKQ in a FOR /F loop. Read the help message of FOR in order to understand how the semantics of quotes are changed by USEBACKQ....
by aGerman
17 Oct 2021 07:12
Forum: DOS Batch Forum
Topic: Script to detect type (encoding) of files
Replies: 16
Views: 1136

Re: Script to detect type (encoding) of files

Proof of concept *** obsolete code removed, see further down ... *** This is only for the evaluation of UTF-8. It doesn't include the BOM check, the file name is currently hard-coded, and it behaves fundamentally differently: - It relies on getting a file with at least 4 bytes length. - It checks up...