Search found 4560 matches

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

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

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

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

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

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

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

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

[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: 112618

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

[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...
by aGerman
27 Oct 2022 11:36
Forum: DOS Batch Forum
Topic: [How-To] Get the hosting terminal app (PowerShell hybrid)
Replies: 0
Views: 45767

[How-To] Get the hosting terminal app (PowerShell hybrid)

With the Win 11 update KB5019509 last week my expectations came true - Microsoft made Windows Terminal the default terminal app, making the good ol' console window kinda obsolete (it's at least another big step towards it). In the past years I wrote a few PowerShell macros that are related to the co...
by aGerman
25 Oct 2022 16:07
Forum: DOS Batch Forum
Topic: ROBOCOPY
Replies: 7
Views: 9719

Re: ROBOCOPY

You're wasting so much time waiting for response. Be brave and try. And if you are still concerned, write robocopy in the google search box...
by aGerman
25 Oct 2022 15:41
Forum: DOS Batch Forum
Topic: ROBOCOPY
Replies: 7
Views: 9719

Re: ROBOCOPY

What's your expectation for a tool with like a hundred options? :lol:
by aGerman
25 Oct 2022 15:37
Forum: DOS Batch Forum
Topic: Compare two directory
Replies: 2
Views: 4387

Re: Compare two directory

Provided the number of tokens separated by an underscore is always 3, and 4 for the sibling: @echo off &setlocal pushd "C:\Data" for /f "delims=" %%i in ('dir /a-d /b "*.pdf"^|findstr /rix "[^_]*_[^_]*_[^_]*\.pdf"') do ( if not exist "%%~ni_*.pdf" echo lone: "%%~i" ) for /f "delims=" %%i in ('dir /a...
by aGerman
25 Oct 2022 09:33
Forum: DOS Batch Forum
Topic: ROBOCOPY
Replies: 7
Views: 9719

Re: ROBOCOPY

Batch 101: Press [Windows]+[R] to open the Run box. Type CMD and hit [Enter] to open a CMD prompt. Type HELP and hit [ENTER] to get an overview of commonly used commands. Type <command> /? (e.g. like ROBOCOPY /? in your specific case) and hit [ENTER] to get detailed information about the command. Th...