Search found 131 matches

by jfl
16 May 2020 08:14
Forum: DOS Batch Forum
Topic: Debugging / syntax checksing tools for batch
Replies: 21
Views: 1530

Re: Debugging / syntax checksing tools for batch

Yet another method for debugging large scripts, that I use a lot, both at home and at work, to debug very large batch files: Use the debugging routines and macros in my Library.bat batch library. This works by instrumenting the problematic code, with macros defined in Library.bat. These macros do no...
by jfl
16 May 2020 02:48
Forum: DOS Batch Forum
Topic: Unlocker
Replies: 6
Views: 771

Re: Unlocker

What you need is a (for /f ...) command. Ex:

Code: Select all

for /f "delims=" %%f in ("UnlockerListofFiles.txt") do (
  C:\Programs\Unlocker\Unlocker.exe "%%~f"
)
by jfl
13 May 2020 04:20
Forum: DOS Batch Forum
Topic: Powershell comment
Replies: 7
Views: 1202

Re: Powershell comment

@aGerman: Hi Steffen, There's an important difference between your %\n% macro and mine. (Beyond the fact that I generated mine with an overly complex sequence) Mine expands to <LF>^ Yours expands to ^<LF> Obviously both work for generating a one-line batch command, which in turn creates a multi-line...
by jfl
08 May 2020 12:01
Forum: DOS Batch Forum
Topic: Powershell comment
Replies: 7
Views: 1202

Re: Powershell comment

The # comment does not work the way you did, because it's a line comment, and the PowerShell command you generated was all on one line for PowerShell. To use such a line comment, you need to generate a PowerShell script that contains multiple lines. This is akin to what we do for generating multi-li...
by jfl
03 May 2020 07:11
Forum: DOS Batch Forum
Topic: HASHSUM.BAT v1.6 - emulate md5sum, shasum, and the like
Replies: 44
Views: 28376

Re: HASHSUM.BAT v1.6 - emulate md5sum, shasum, and the like

surely an external command can read a binary file redirected to stdin. This is deviating way off the main topic of this thread, but yes, this is a problem. (Here we're talking about programs that eat/produce/filter text, not binary data like sound or images.) I tried many things, then ended up usin...
by jfl
02 May 2020 08:38
Forum: DOS Batch Forum
Topic: HASHSUM.BAT v1.6 - emulate md5sum, shasum, and the like
Replies: 44
Views: 28376

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: 44
Views: 28376

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

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

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

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

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: 8
Views: 8326

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

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

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...