Search found 4506 matches

by aGerman
08 Nov 2022 14:11
Forum: DOS Batch Forum
Topic: Finding an error
Replies: 10
Views: 8437

Re: Finding an error

I've seen things like that if some lines in the script end with only LF instead of CRLF.

Steffen
by aGerman
08 Nov 2022 14:08
Forum: DOS Batch Forum
Topic: FOR /F works on WIN 10 and not on XP
Replies: 2
Views: 3271

Re: FOR /F works on WIN 10 and not on XP

Usually the ~ introduces modifiers in FOR variables. Do you see the same behavior with a letter as variable name?

Steffen
by aGerman
08 Nov 2022 10:44
Forum: DOS Batch Forum
Topic: Finding an error
Replies: 10
Views: 8437

Re: Finding an error

Open a CMD prompt, navigate to the script folder using the CD command, and run your script by calling it from the prompt.

FWIW What should people ever do with a screenshot of code? It's like a picture of a bar of soap. Try to wash your fingers with it :lol:

Steffen
by aGerman
06 Nov 2022 14:52
Forum: DOS Batch Forum
Topic: Passing arguments to a subroutine
Replies: 4
Views: 3977

Re: Passing arguments to a subroutine

Another guess: I suspect "mypassword" is something different in real world. If it contains characters like % or ^ the CALL command will alter it.

Steffen
by aGerman
04 Nov 2022 10:31
Forum: DOS Batch Forum
Topic: Timeout via for loop
Replies: 15
Views: 10067

Re: Timeout via for loop

You have this line:

Code: Select all

findstr /C:"%a" %cd%\Logs\*.*
Doesn't it already display the found string?

Steffen
by aGerman
04 Nov 2022 10:24
Forum: DOS Batch Forum
Topic: Script with folder variable name (in path)
Replies: 1
Views: 1490

Re: Script with folder variable name (in path)

You need to do this in two steps. Something about like that night work for you.

Code: Select all

for /d %%i in ("%programdata%\ACE_Trainers\ACE_350\*.*.*") do del /q "%%~i\Tracking\*.xml"
Steffen
by aGerman
01 Nov 2022 13:57
Forum: DOS Batch Forum
Topic: error on for /f in the block
Replies: 3
Views: 1866

Re: error on for /f in the block

If you really need the delayed expansion of n1 then your best bet might be to run the loop in a subroutine. Another approach could be processing the output of MORE +!n1! "filename".

Steffen
by aGerman
01 Nov 2022 03:18
Forum: DOS Batch Forum
Topic: Timeout via for loop
Replies: 15
Views: 10067

Re: Timeout via for loop

Check this out. Just run it, it can't do any harm yet. Then carefully read the comments in order to understand how to customize it. Steffen @echo off REM create both Carriage Return, and the combination of Backspace-Space-Backspace once at the beginning of your code for /f "tokens=1,2 delims=#" %%a ...
by aGerman
31 Oct 2022 15:57
Forum: DOS Batch Forum
Topic: Timeout via for loop
Replies: 15
Views: 10067

Re: Timeout via for loop

ECHO does always write a new line. You need to use the SET /P trick. However, that's not enough. You also need both a Carriage Return character to jump back to the beginning of the line, and the combination of Backspace-Space-Backspace characters to overwrite the previous last character in the line ...
by aGerman
30 Oct 2022 08:54
Forum: DOS Batch Forum
Topic: [Destructive, Use Caution] Copy tags and its child elements from specific XML schema
Replies: 23
Views: 11272

Re: Copy tags and its child elemnts from specific XML schema

I've been not talking about using something else than XML. I've been talking about using another scripting language to process the XML text. PowerShell, VBScript, JScript for example support the XML DOM to process XML data in a proper way, while Batch does not.

Steffen
by aGerman
30 Oct 2022 03:58
Forum: DOS Batch Forum
Topic: [Destructive, Use Caution] Copy tags and its child elements from specific XML schema
Replies: 23
Views: 11272

Re: Copy tags and its child elemnts from specific XML schema

Why oh why are people still trying to accomplish those tasks in batch :( Batch supports line-wise processing of text while XML would be perfectly valid if the whole content was in just one line. Batch is not able to grasp the logical object structure of XML. So what you're doing in Batch is kind of ...
by aGerman
29 Oct 2022 09:34
Forum: DOS Batch Forum
Topic: Center Window and Move Window (yet more Powershell hybrids)
Replies: 7
Views: 7992

Re: Center Window and Move Window (yet more Powershell hybrids)

I updated the initial post to support other windows, such like Windows Terminal.

Steffen
by aGerman
29 Oct 2022 09:19
Forum: DOS Batch Forum
Topic: [How-To] Get information about the conhost window, update its mode settings (PowerShell hybrid)
Replies: 0
Views: 26348

[How-To] Get information about the conhost window, update its mode settings (PowerShell hybrid)

The code below contains two macros. 1) The %ConsoleInfo% macro outputs a sequence of "name=value" pairs which provide information about the console window, such like its appearance, settings, and environment. 2) The %SetConsoleMode% macro updates mode settings of the console window. The mode is an i...
by aGerman
28 Oct 2022 15:06
Forum: DOS Batch Forum
Topic: Complete control of cmd windows
Replies: 88
Views: 57730

Re: Complete control of cmd windows

And in this thread I describe a method to load a PowerShell engine just one time and reuse it from a Batch file many times, so the response time is almost the same as an auxiliary .exe file written in assembly language... That's the reason why I asked for the use case. Your technique works marvello...
by aGerman
27 Oct 2022 12:47
Forum: DOS Batch Forum
Topic: [How-To] Fade a window, or make it transparent to a certain extent (PowerShell hybrid)
Replies: 0
Views: 26229

[How-To] Fade a window, or make it transparent to a certain extent (PowerShell hybrid)

By default, the %Fade% macro targets the current console window. Optionally, you may pass the process ID of a process whose main window is to be faded. If you target the Windows Terminal, or if you're unsure whether your script spawns a conhost or a Windows Terminal process, pass the PID returned by...