Search found 227 matches

by jfl
21 Feb 2020 01:55
Forum: DOS Batch Forum
Topic: How to print to first line of txt file?
Replies: 2
Views: 5984

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: 9
Views: 26878

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

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

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

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

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

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

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

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

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...
by jfl
05 Dec 2019 17:35
Forum: DOS Batch Forum
Topic: A dual Batch+CSS script to convert Markdown to HTML
Replies: 4
Views: 6190

A dual Batch+CSS script to convert Markdown to HTML

I've published on my github SysToolsLib library a new batch file called md2h.bat . This batch converts a Markdown text file into an HTML file, and displays it in a Web browser. This is useful if you're editing Markdown files, and want to know what they will look like once pushed into GitHub. For tha...
by jfl
05 Oct 2019 14:18
Forum: DOS Batch Forum
Topic: Automatically escaping strings to survive multiple parsings
Replies: 3
Views: 10015

Re: Automatically escaping strings to survive multiple parsings

You're right, I had not thought about recursive cases like this where different part of the command string are parsed different number of times. Indeed it's necessary to invoke my routines multiple times, with growing strings: C:\JFL\Temp>Library.bat -te "echo a&echo b" off _INITIAL=echo a&echo b # ...
by jfl
05 Oct 2019 11:06
Forum: DOS Batch Forum
Topic: Automatically escaping strings to survive multiple parsings
Replies: 3
Views: 10015

Automatically escaping strings to survive multiple parsings

There are many cases where batch strings are parsed multiple times before being used. For example when you build a command line from multiple parts, or pass arguments to a subroutine. Each time it's tricky if the command or arguments contain special characters like ^ & | ! etc... In that case, it's ...
by jfl
02 Oct 2019 03:00
Forum: DOS Batch Forum
Topic: Enabling the internal debug outputs of cmd.exe
Replies: 18
Views: 39357

Re: Enabling the internal debug outputs of cmd.exe

This seems highly dependent on the Windows 10 version:

In version 10.0.14393, this works, but the cmd shell hangs in the end.

In version 10.0.18362, this does not work (ie. there's no debug output, only the echo %%1 output), but the cmd shell silently exits.