Search found 120 matches

by jfl
01 Oct 2019 06:45
Forum: DOS Batch Forum
Topic: Some tricks with undefined variables
Replies: 3
Views: 6319

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

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

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

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...
by jfl
26 Sep 2019 05:45
Forum: DOS Batch Forum
Topic: which.exe - The best of Windows where.exe and Unix which, and some more
Replies: 5
Views: 6005

Re: which.exe - The best of Windows where.exe and Unix which, and some more

Here's version 1.14 of my which.exe program for DOS and Windows: http://jf.larvoire.free.fr/progs/which_v1.14.zip Note that this zip file contains multiple versions of which.exe: The one at the root, which runs in all Microsoft OSs, as explained in the opening post ; And several stripped down versio...
by jfl
28 Jul 2019 09:53
Forum: DOS Batch Forum
Topic: self-compiled .net hybrids
Replies: 25
Views: 18892

Re: self-compiled .net hybrids

One small improvement to the batch initialization: During the JS development phase, it's necessary to recompile the source script every time it's updated. The following code automates that: @echo off setlocal set "jsc=" for /r "%SystemRoot%\Microsoft.NET\Framework\" %%# in ("*jsc.exe") do set "jsc=%...
by jfl
07 May 2019 07:50
Forum: DOS Batch Forum
Topic: A new tool to save and restore the console font
Replies: 4
Views: 1739

Re: A new tool to save and restore the console font

font.exe version 2.1.1 is now available on https://github.com/JFLarvoire/SysToolsLib/releases, with the following changes:
  • Fixed the TrueType fonts setting, which sometimes ended up looking blurry.
  • Added an optional font weight argument.
Run 'font -?' to get a help screen.
by jfl
11 Apr 2019 06:24
Forum: DOS Batch Forum
Topic: Command only listing active NIC?
Replies: 2
Views: 909

Re: Command only listing active NIC?

I have a script that does just that: ipcfg.bat , part of my System Tools Library ipcfg.bat has lots of options. But the idea is to select only "interesting" network information. By default, it outputs just the information for the active NICs, as you're trying to do. Examples: C:\JFL\Temp>ipcfg -l Et...
by jfl
04 Apr 2019 03:00
Forum: DOS Batch Forum
Topic: Ipconfig doesn't work inside a bat file
Replies: 18
Views: 3548

Re: Ipconfig doesn't work inside a bat file

None of the Microsoft ping programs (ping, pathping, psping) output: Enter the ping options: I tried that on several of my systems, with various Windows versions, and indeed none of them contain that string. Ex: C:\JFL\Temp>strings C:\Windows\System32\ping.exe | findstr /i please C:\JFL\Temp>string...
by jfl
02 Apr 2019 09:44
Forum: DOS Batch Forum
Topic: which.exe - The best of Windows where.exe and Unix which, and some more
Replies: 5
Views: 6005

Re: which.exe v1.12 - Now efficiently detecting doskey macros and PS aliases

That's a neat tool, I like it :) Thanks! I have a question as to how option -a is intended to work. If I run 'which -a cmd.exe' I was expecting that more than one file was found on my Win10 x64. Also if I run it in the WOW64 subsystem, it reports that cmd.exe was found in System32, which isn't wron...
by jfl
26 Mar 2019 12:54
Forum: DOS Batch Forum
Topic: which.exe - The best of Windows where.exe and Unix which, and some more
Replies: 5
Views: 6005

which.exe - The best of Windows where.exe and Unix which, and some more

Announcing which.exe, a tool for searching which programs will run at the command.com, cmd.exe, or PowerShell prompts. This which.exe program strives to implement the best of both Unix which and Windows where.exe, and a bit more! Features: Allows passing just the base name of a command, and uses the...
by jfl
12 Mar 2019 03:33
Forum: DOS Batch Forum
Topic: UTF-8 bug
Replies: 19
Views: 4247

Re: UTF-8 bug

Arriving a bit late in this thread, but hopefully with a few interesting links: The console always works in UCS-2 mode, whatever the code page you're using. That is is records 16-bits Unicode version 1 characters in each cell. Ascii or non-ascii is irrelevant: Ascii is just the first 128 Unicode cha...
by jfl
12 Feb 2019 07:17
Forum: DOS Batch Forum
Topic: findstr /C:""" file.txt&&set found=1 FAILS
Replies: 6
Views: 1902

Re: findstr /C:""" file.txt&&set found=1 FAILS

The ^ escaping works outside of quoted strings. Inside quoted strings, ^ is a normal character. ^""" passes """ to the findstr.exe program "^"" passes "^"" to the findstr.exe program Same thing for the ^| character in your first example. It's inside a quoted string, so 1) The ^ is useless, as | bein...
by jfl
12 Feb 2019 04:53
Forum: DOS Batch Forum
Topic: Set Window Topmost (Powershell hybrids)
Replies: 4
Views: 1271

Re: Set Window Topmost (Powershell hybrids)

Actually triple language Batch+PowerShell+C# macros. Impressive! :D

And the performance is actually better than what I feared. (About 0.5s per macro invocation on my system.)
This opens up infinite possibilities with all the .NET framework at hand.
by jfl
12 Feb 2019 04:26
Forum: DOS Batch Forum
Topic: How do I rerun AUTOEXEC?
Replies: 2
Views: 743

Re: How do I rerun AUTOEXEC?

autoexec.bat was a feature of MS-DOS. Are you still using MS-DOS? Windows XP and later are not based on MS-DOS, and do not run autoexec.bat by default. (Unless maybe you have changed the Windows Command Prompt's startup command to something like: %windir%\system32\cmd.exe /k "C:\autoexec.bat") Anywa...