Search found 173 matches

by jfl
16 Apr 2021 15:43
Forum: DOS Batch Forum
Topic: Windows (and Office?) product key finder
Replies: 13
Views: 937

Re: Windows (and Office?) product key finder

T3RRY wrote:
12 Apr 2021 19:54
You could simply use:

Code: Select all

wmic  path softwarelicensingservice get OA3xOriginalProductKey | findstr /r ".....-"
This does not work for me. I tested it on 5 different systems, with different versions of Windows, and it either returns nothing, or a WMI query error.
by jfl
16 Apr 2021 15:36
Forum: DOS Batch Forum
Topic: Clobbered cmd.exe!
Replies: 7
Views: 769

Re: Clobbered cmd.exe!

Or you can open a PowerShell. You don't need cmd for that. Then everything will be usable normally, except batch files.
by jfl
22 Feb 2021 09:10
Forum: DOS Batch Forum
Topic: Apostrophe at beginning of file name
Replies: 6
Views: 1671

Re: Apostrophe at beginning of file name

A few more observations: 1) The problem is not related to the use of the usebackq option. Even without it, I get the very same error for 11-bytes file names: C:\JFL\SRC\Batch\dostips>for /f "delims=" %G IN ('myfile.txt) do @echo %G 'myfile.txt line 1 The system cannot find the file 쾻뭂ᨀ耀∟. C:\JFL\SRC...
by jfl
22 Feb 2021 07:33
Forum: DOS Batch Forum
Topic: Best way to setup a "Dictionary" similar to VBA?
Replies: 16
Views: 3313

Re: Best way to setup a "Dictionary" similar to VBA?

Except that with real files, it's much slower, and very fragile: If other files have one of these extensions, the code will break.
by jfl
21 Feb 2021 11:40
Forum: DOS Batch Forum
Topic: Interpret json with batch
Replies: 4
Views: 1407

Re: Interpret json with batch

There's also this beautiful example that aGerman posted last month:
In "JSON file in wrong format" post #4
It is also a Batch/JScript hybrid, and the JScript part creates an HTML object, to use its JSON decoding capabilities.
by jfl
15 Feb 2021 07:55
Forum: DOS Batch Forum
Topic: How to use the output of my first command in my second command in one step?
Replies: 5
Views: 1606

Re: How to use the output of my first command in my second command in one step?

This can be done easily using helper scripts: $.bat , described in this thread . regx.bat , from that same System Tools Library. regx.bat makes it easy to get the content of a registry value. It works as if the registry were a filesystem, with keys as directories, and values as files: regx type HKCU...
by jfl
09 Feb 2021 08:31
Forum: DOS Batch Forum
Topic: Cmd.exe bug with special characters
Replies: 2
Views: 1288

Re: Cmd.exe bug with special characters

This is because %0 is the command string you typed, not the actual script name. In the first case, it's quoted, so the special characters do not confuse the echo command. In the second case, it's not quoted, and the special & and ( characters (which have lost their protecting ^ at this stage) do con...
by jfl
08 Feb 2021 01:42
Forum: DOS Batch Forum
Topic: How to get rid of the extra character ahead of the title
Replies: 11
Views: 2296

Re: How to get rid of the extra character ahead of the title

Yes, VT sequences came again with the new console on Win 10. If you need something more downward compatible, try wrapping SetWindowText (SetConsoleTitle didn't work in my tests). No, it's not needed in Windows 7, because the title command in Windows 7 does not add that extra space that is annoying ...
by jfl
07 Feb 2021 13:08
Forum: DOS Batch Forum
Topic: How to get rid of the extra character ahead of the title
Replies: 11
Views: 2296

Re: How to get rid of the extra character ahead of the title

Excellent, thanks! :D I did not know that such Xterm escape sequences worked in the old console too. This seems something new in Windows 10 though, because a quick test in Windows 7 did not work there. Just curious, why do you set that admintitle variable, and invoke it as a second command afterward...
by jfl
29 Jan 2021 14:58
Forum: DOS Batch Forum
Topic: MODE CON:...
Replies: 2
Views: 1049

Re: MODE CON:...

Could it be that the 'mode con' moves the cursor to the top left corner every time?
by jfl
27 Jan 2021 12:42
Forum: DOS Batch Forum
Topic: How to get rid of the extra character ahead of the title
Replies: 11
Views: 2296

How to get rid of the extra character ahead of the title

As search does not work anymore on the forum (Anybody looking at this?), I'm turning to other peoples' memory... I noticed that the title command inserts an extra space in front of the title string. By default, my cmd console has the title: Administrator: Command Prompt But if I run: title Command P...
by jfl
27 Jan 2021 12:14
Forum: DOS Batch Forum
Topic: A script making it easy to set a variable with the output of a command
Replies: 3
Views: 1167

Re: A script making it easy to set a variable with the output of a command

I've updated $.bat . It now creates a list with one entry for each non-empty line in the command output. This makes it really usable for the Docker scenarios that motivated me to begin this effort. Entries that contain spaces or special characters are quoted. This allows looping on the list. Ex: C:\...
by jfl
25 Jan 2021 08:10
Forum: DOS Batch Forum
Topic: SORT /UNIQUE /UNI_OUTPUT...
Replies: 4
Views: 1353

Re: SORT /UNIQUE /UNI_OUTPUT...

Ah, OK!
I expected it would output strings like case-dependent sorts in Unix:

Code: Select all

ABC
XYZ
abc
xyz
I just checked /CASE_SENSITIVE is present in XP and later versions of Windows, but not in Windows 98. Funny I never heard of it.
by jfl
25 Jan 2021 06:35
Forum: DOS Batch Forum
Topic: SORT /UNIQUE /UNI_OUTPUT...
Replies: 4
Views: 1353

Re: SORT /UNIQUE /UNI_OUTPUT...

I think that TEMP and path are not part of the supported options. /TEMP worked for you as an abbreviation of the documented /TEMPORARY option. Also note that contrary to the other options before it, it is part of a longer string "TEMP path": C:\Windows\System32>strings sort.exe | ag "[a-z]{4,}" [Uni...
by jfl
24 Jan 2021 09:15
Forum: DOS Batch Forum
Topic: Request for help to speed up batch program for 17,000 TXT files
Replies: 6
Views: 1341

Re: Request for help to speed up batch program for 17,000 TXT files

For quickly searching for strings in a large set of text files, try The Silver Searcher . The ag.exe program in that zip file is a port for Windows that I maintain, of the Unix tool ag. It supports full fledged regular expressions, so finding any sequence of valid characters you can think of will be...