Search found 116 matches

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: 2
Views: 248

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

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

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

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

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

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

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

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: 17
Views: 14889

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.
by jfl
02 Oct 2019 02:36
Forum: DOS Batch Forum
Topic: Simple Batch Code to Detect Empty Sub-folder
Replies: 4
Views: 5046

Re: Simple Batch Code to Detect Empty Sub-folder

OK, I was showing the principle, not the exact code you need. In your case, that would be: dir /b "C:\TIER1\TIER2" | findstr /r . >NUL 2>NUL if errorlevel 1 ( rem The C:\TIER1\TIER2 directory is empty echo There were no files or folders to be deleted. ) else ( rem The C:\TIER1\TIER2 directory contai...
by jfl
01 Oct 2019 07:49
Forum: DOS Batch Forum
Topic: non-buffering FOR /F alternative
Replies: 7
Views: 6832

Re: non-buffering FOR /F alternative

Hi Steffen Your DirEvents.exe tool is impressively small, and it works nicely, except for one detail: How do you stop it? I tried Enter, ESC, Ctrl-C, and many other key combinations, without success. And I could not find any clue in the source. Eventually I had to kill it in Task Manager, which is n...
by jfl
01 Oct 2019 06:45
Forum: DOS Batch Forum
Topic: Some tricks with undefined variables
Replies: 3
Views: 5982

Re: Some tricks with undefined variables

Thanks jeb for these nice tricks! The first one really baffled me :shock: Five years ago, I thought I knew everything about batch, and I keep learning new tricks here! :D About trick 3): It's worth defining a macro for easy reuse: @echo off setlocal DisableDelayedExpansion set ECHO!=FOR /F "tokens=1...
by jfl
01 Oct 2019 04:47
Forum: DOS Batch Forum
Topic: powershell to bat
Replies: 1
Views: 4327

Re: powershell to bat

Use PowerShell's get-service to get the correspondence between the one-word service name used by the net.exe and sc.exe commands, and the more descriptive name used by PowerShell service management commands. Then simply use 'net start NAME' or 'net stop NAME' in your batch to start or stop the servi...
by jfl
01 Oct 2019 04:06
Forum: DOS Batch Forum
Topic: Simple Batch Code to Detect Empty Sub-folder
Replies: 4
Views: 5046

Re: Simple Batch Code to Detect Empty Sub-folder

I first tried 'if not exist subdir\* echo empty', but this does not work :-( So the solution is to list the sub-folder contents, and check for the presence of anything using 'findstr /r .'. The result is in findstr's %ERRORLEVEL%. Ex: C:\JFL\Temp\test>md Empty C:\JFL\Temp\test>md HasFile C:\JFL\Temp...
by jfl
01 Oct 2019 02:40
Forum: DOS Batch Forum
Topic: Thoughts on this alternative method of obtaining cmdcmdline arguments (safe for all characters?)
Replies: 14
Views: 7874

Re: Thoughts on this alternative method of obtaining cmdcmdline arguments (safe for all characters?)

Getting 500 server error messages each time I either edit or submit a post. Anyone else getting these? Tried to edit the OP twice subsequent to the first edit and it failed. Yes, I got these as well when I tried posting a message about my updated version of which.exe last week. I retried several ti...