Search found 141 matches

by jfl
02 May 2020 08:38
Forum: DOS Batch Forum
Topic: HASHSUM.BAT v1.6 - emulate md5sum, shasum, and the like
Replies: 47
Views: 31601

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.6 - emulate md5sum, shasum, and the like
Replies: 47
Views: 31601

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

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

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 ...
by jfl
21 Feb 2020 01:55
Forum: DOS Batch Forum
Topic: How to print to first line of txt file?
Replies: 2
Views: 3811

Re: How to print to first line of txt file?

For every line you'd need to do some complex manipulation, like: WriteLine > PingLog2.txt type PingLog.txt >> PingLog2.txt del PingLog.txt ren PingLog2.txt PingLog2.txt Is this worth it? Instead, I suggest that you consider using a Windows port of the Unix tail tool. For example get tail.exe from Un...
by jfl
20 Feb 2020 08:18
Forum: DOS Batch Forum
Topic: Bug in vt101 Alternate Screen Buffer?
Replies: 7
Views: 6158

Re: Bug in vt101 Alternate Screen Buffer?

Same for me: - Crashes on company-managed computer with Windows 10.0.16299.1625 - Works fine on another one managed by me, with Windows 10.0.19041.84 On the system that crashes, there's an error saying "Console Window Host has stopped working." So apparently the problem is with conhost.exe, not with...
by jfl
08 Feb 2020 04:19
Forum: DOS Batch Forum
Topic: SUDO for CMD
Replies: 9
Views: 9101

Re: SUDO for CMD

This works great indeed!

Now, what would be very nice is to find a way to redirect stdin/stdout/stderr from the elevated shell, back into the original shell. 8)
(Like Unix' sudo does!)
by jfl
01 Feb 2020 04:26
Forum: DOS Batch Forum
Topic: Quoting Issue
Replies: 2
Views: 3026

Re: Quoting Issue

This is due to the way the child cmd.exe instance processes double quotes on its command line. (And it does not matter if that child instance is invoked using single quotes ' or back ticks `.) Extract from the cmd /? help screen : 1. If all of the following conditions are met, then quote characters ...
by jfl
31 Jan 2020 10:51
Forum: DOS Batch Forum
Topic: Problems with taskkill /PID
Replies: 1
Views: 2582

Re: Problems with taskkill /PID

The list of tasks running in Windows is very long, and keeps changing all the time. Even if you don't start or stop anything yourself. It'll be much more reliable to filter lists before comparing them. Also, wait for a while before getting the second list, to give time to Firefox to start. @echo off...
by jfl
10 Jan 2020 09:26
Forum: DOS Batch Forum
Topic: Is there a way to update progress bar in Windows Vista to 10?
Replies: 5
Views: 2922

Re: Is there a way to update progress bar in Windows Vista to 10?

2. What is the difference between bitsadmin and bitsadmin.exe? If you don't provide the extension, cmd.exe will try all the extensions in enviroment variable PATHEXT, and use the first program that matches. Could it be that you named your test script "bitsadmin.bat" ? In that case, this explains wh...
by jfl
10 Jan 2020 08:53
Forum: DOS Batch Forum
Topic: Move/copy files based on a list of requests
Replies: 2
Views: 1255

Re: Move/copy files based on a list of requests

Hi Ovisele, It's probably feasible in Batch, but it'll be very hard. I'd recommend that you use a more powerful language for that. (JScript, PowerShell, or Python) If you really want to use Batch, and if you're sure the _ and . characters can never appear within one of the filename components, you c...
by jfl
10 Jan 2020 08:32
Forum: DOS Batch Forum
Topic: cmd.exe chars needing quotes, and escaping redirection handles
Replies: 6
Views: 2116

Re: cmd.exe chars needing quotes, and escaping redirection handles

About completion characters: On my laptop (Windows version 10.0.19037.1), the Tab key already does file completion in cmd windows, even if you don't use cmd /F. And Shift+Tab cycles backwards. Looking in the registry, I see that both HKLM CompletionChar values contain 0x40, and both HKCU values cont...
by jfl
12 Dec 2019 11:21
Forum: DOS Batch Forum
Topic: The most primitive XML writer (just for fun)
Replies: 7
Views: 2728

Re: The most primitive XML writer (just for fun)

Nice script indeed. :D
Actually, the only thing that's really missing is another option to close an open block. (The - sign maybe?)
With that, we'd be able to generate tables, etc.

Code: Select all

call :xml table
call :xml row
call :xml td "Row 1 column 1"
...
call :xml row -
call :xml table -
by jfl
07 Dec 2019 04:52
Forum: DOS Batch Forum
Topic: A dual Batch+CSS script to convert Markdown to HTML
Replies: 4
Views: 2265

Re: A dual Batch+CSS script to convert Markdown to HTML

There is another API supporting their "gfm" extensions. See their Markdown Rest API page. I chose to use the API using just the "raw" markdown, because this is the one used for all *.md files in code repositories. (This raw markdown already includes some extensions versus plain markdown, such as tab...