Search found 227 matches

by jfl
07 Aug 2020 09:55
Forum: DOS Batch Forum
Topic: CONVERTCP.exe - Convert text from one code page to another
Replies: 134
Views: 216607

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: 4065

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: 4065

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: 134
Views: 216607

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: 134
Views: 216607

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: 2791

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: 27
Views: 22372

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: 5414

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: 5960

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: 5960

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.8 - emulate md5sum, shasum, and the like
Replies: 61
Views: 92197

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...
by jfl
02 May 2020 08:38
Forum: DOS Batch Forum
Topic: HASHSUM.BAT v1.8 - emulate md5sum, shasum, and the like
Replies: 61
Views: 92197

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

Hi Dave pipes do not in and of themselves do any type of transformation. You're splitting hairs! OK, it's not actually the pipe that does the transformation, it's the batch interpreter that does it before passing the data to the pipe. In practice, the effect is the same: Any pipe in a batch involves...
by jfl
01 May 2020 08:03
Forum: DOS Batch Forum
Topic: HASHSUM.BAT v1.8 - emulate md5sum, shasum, and the like
Replies: 61
Views: 92197

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

Is your console using code page 65001? This script uses sub-commands and pipes internally. Any text that is piped from one application to another, or passed as an argument to a sub-command, is converted to the console code page for that. So if your code page does not include Chinese characters, they...
by jfl
29 Apr 2020 09:51
Forum: DOS Batch Forum
Topic: file path with changing folder name
Replies: 2
Views: 3709

Re: file path with changing folder name

Hello, Try using subroutines :jdate and :jdate2date from this very site library of functions: https://www.dostips.com/DtCodeCmdLib.php#Function.jdate Ex: call :jdate TODAY &:# Get today's day number set /a "YESTERDAY=TODAY-1" &:# Get yesterday's day number call :jdate2date YESTERDAY YEAR MONTH DAY &...
by jfl
02 Mar 2020 07:39
Forum: DOS Batch Forum
Topic: mshta command for copy into clipboard
Replies: 10
Views: 12003

Re: mshta command for copy into clipboard

I was not aware it was possible to do one-line HTML applications like this. Nice! If you don't find a native HTA way, maybe it'd be possible to return the user choice number as the HTML Application exit code, then send that to the clipboard using an outside tool? There's an example on how to return ...