Search found 141 matches

by jfl
04 Sep 2020 08:29
Forum: DOS Batch Forum
Topic: new way for downloading files
Replies: 4
Views: 330

Re: new way for downloading files

It's wildly exaggerated FUD:
There are many many ways to download files in Windows, and EVERY one of them can be used to download anything, including malware.
This is the beauty and the risk of liberty.
by jfl
03 Sep 2020 11:58
Forum: DOS Batch Forum
Topic: [How-To] Distinguish between console and terminal (PowerShell hybrid)
Replies: 6
Views: 634

Re: [How-To] Distinguish between console and terminal (PowerShell hybrid)

Thanks Steffen. I gave it a try, and it's working fine on my system. Still, it's a bit risky to rely on an undocumented API side effect. My own tools work fine in both the old console, and the new terminal, except for a few minor differences with the chars.exe tool: It is confused by the terminal in...
by jfl
18 Aug 2020 09:32
Forum: DOS Batch Forum
Topic: CONVERTCP.exe - Convert text from one code page to another
Replies: 122
Views: 95567

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

how many bytes do you actually stop trying to figure out what encoding you got? Currently I scan the whole file after loading it in memory, counting even NULs, odd NULs, non-ASCII bytes, invalid UTF-8 sequences. Then in the end, based on these counts, I select the most likely encoding among UTF-16,...
by jfl
17 Aug 2020 10:29
Forum: DOS Batch Forum
Topic: CONVERTCP.exe - Convert text from one code page to another
Replies: 122
Views: 95567

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

So maybe I just still missunderstand it, but obviously conv expects to read ANSI-encoded (1252) text from the pipe. You're right. I was convinced of the contrary, but indeed after looking at the source, this is the way it was. :shock: I had forgotten about that, but I had changed it that way, becau...
by jfl
07 Aug 2020 09:55
Forum: DOS Batch Forum
Topic: CONVERTCP.exe - Convert text from one code page to another
Replies: 122
Views: 95567

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

Typically C, C++, ANSI-C and ANSI-C++ don't do that I know it's very rarely used. It's Microsoft C specific, hence the underscore ahead of the function name _setmode(). But it's ideal for tools wanting to output Unicode into the Windows console, independently of the code page. Actually I'm pretty s...
by jfl
07 Aug 2020 06:49
Forum: DOS Batch Forum
Topic: Run Here tool
Replies: 4
Views: 660

Re: Run Here tool

Thanks, works great now :D
by jfl
07 Aug 2020 03:54
Forum: DOS Batch Forum
Topic: Run Here tool
Replies: 4
Views: 660

Re: Run Here tool

Thanks Ildar, this is a useful tool. I immediately used it to restore a context menu entry I missed from old versions of Windows: run-here /I "Command Here" /K C:\Windows\System32\cmd.exe C:\Windows\System32\cmd.exe It works, except for a small annoyance: It starts cmd.exe in the parent directory of...
by jfl
07 Aug 2020 03:17
Forum: DOS Batch Forum
Topic: CONVERTCP.exe - Convert text from one code page to another
Replies: 122
Views: 95567

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

Hi Steffen, You still have to condition the console window for UTF-16 output and restore the old behavior if you're done. It's the stdout file that I switch to 16-bits mode, not the console. This is done using the C library function _setmode(fileno(stdout), _O_WTEXT). I suppose that the cleanup is d...
by jfl
03 Aug 2020 07:21
Forum: DOS Batch Forum
Topic: CONVERTCP.exe - Convert text from one code page to another
Replies: 122
Views: 95567

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

@aGerman Hi Steffen, In my own code page conversion tool conv.exe , I use a heuristic for selecting a default output code page, that works very well in practice: If stdout is a console, then switch it to 16-bits mode, and output UTF-16. (This allows displaying all Unicode characters, whatever the cu...
by jfl
29 Jul 2020 14:10
Forum: DOS Batch Forum
Topic: Quotation Marks.
Replies: 2
Views: 537

Re: Quotation Marks.

What does this do . . . set "params=%*" %* means "all arguments"; Or more precisely the whole argument line that was passed to the script or function. So the above command stores all the script or function arguments into variable params Now, to go more in depth about this, for maximum safety, I rec...
by jfl
16 May 2020 08:14
Forum: DOS Batch Forum
Topic: Debugging / syntax checksing tools for batch
Replies: 25
Views: 3097

Re: Debugging / syntax checksing tools for batch

Yet another method for debugging large scripts, that I use a lot, both at home and at work, to debug very large batch files: Use the debugging routines and macros in my Library.bat batch library. This works by instrumenting the problematic code, with macros defined in Library.bat. These macros do no...
by jfl
16 May 2020 02:48
Forum: DOS Batch Forum
Topic: Unlocker
Replies: 6
Views: 1300

Re: Unlocker

What you need is a (for /f ...) command. Ex:

Code: Select all

for /f "delims=" %%f in ("UnlockerListofFiles.txt") do (
  C:\Programs\Unlocker\Unlocker.exe "%%~f"
)
by jfl
13 May 2020 04:20
Forum: DOS Batch Forum
Topic: Powershell comment
Replies: 7
Views: 1715

Re: Powershell comment

@aGerman: Hi Steffen, There's an important difference between your %\n% macro and mine. (Beyond the fact that I generated mine with an overly complex sequence) Mine expands to <LF>^ Yours expands to ^<LF> Obviously both work for generating a one-line batch command, which in turn creates a multi-line...
by jfl
08 May 2020 12:01
Forum: DOS Batch Forum
Topic: Powershell comment
Replies: 7
Views: 1715

Re: Powershell comment

The # comment does not work the way you did, because it's a line comment, and the PowerShell command you generated was all on one line for PowerShell. To use such a line comment, you need to generate a PowerShell script that contains multiple lines. This is akin to what we do for generating multi-li...
by jfl
03 May 2020 07:11
Forum: DOS Batch Forum
Topic: HASHSUM.BAT v1.6 - emulate md5sum, shasum, and the like
Replies: 47
Views: 31453

Re: HASHSUM.BAT v1.6 - emulate md5sum, shasum, and the like

surely an external command can read a binary file redirected to stdin. This is deviating way off the main topic of this thread, but yes, this is a problem. (Here we're talking about programs that eat/produce/filter text, not binary data like sound or images.) I tried many things, then ended up usin...