I've seen things like that if some lines in the script end with only LF instead of CRLF.
Steffen
Search found 4506 matches
- 08 Nov 2022 14:11
- Forum: DOS Batch Forum
- Topic: Finding an error
- Replies: 10
- Views: 8722
- 08 Nov 2022 14:08
- Forum: DOS Batch Forum
- Topic: FOR /F works on WIN 10 and not on XP
- Replies: 2
- Views: 3412
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
Steffen
- 08 Nov 2022 10:44
- Forum: DOS Batch Forum
- Topic: Finding an error
- Replies: 10
- Views: 8722
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
Steffen
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
Steffen
- 06 Nov 2022 14:52
- Forum: DOS Batch Forum
- Topic: Passing arguments to a subroutine
- Replies: 4
- Views: 4140
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
Steffen
- 04 Nov 2022 10:31
- Forum: DOS Batch Forum
- Topic: Timeout via for loop
- Replies: 15
- Views: 10472
Re: Timeout via for loop
You have this line:
Doesn't it already display the found string?
Steffen
Code: Select all
findstr /C:"%a" %cd%\Logs\*.*
Steffen
- 04 Nov 2022 10:24
- Forum: DOS Batch Forum
- Topic: Script with folder variable name (in path)
- Replies: 1
- Views: 1590
Re: Script with folder variable name (in path)
You need to do this in two steps. Something about like that night work for you.
Steffen
Code: Select all
for /d %%i in ("%programdata%\ACE_Trainers\ACE_350\*.*.*") do del /q "%%~i\Tracking\*.xml"
- 01 Nov 2022 13:57
- Forum: DOS Batch Forum
- Topic: error on for /f in the block
- Replies: 3
- Views: 1986
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
Steffen
- 01 Nov 2022 03:18
- Forum: DOS Batch Forum
- Topic: Timeout via for loop
- Replies: 15
- Views: 10472
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 ...
- 31 Oct 2022 15:57
- Forum: DOS Batch Forum
- Topic: Timeout via for loop
- Replies: 15
- Views: 10472
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 ...
- 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: 11811
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
Steffen
- 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: 11811
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 ...
- 29 Oct 2022 09:34
- Forum: DOS Batch Forum
- Topic: Center Window and Move Window (yet more Powershell hybrids)
- Replies: 7
- Views: 8285
Re: Center Window and Move Window (yet more Powershell hybrids)
I updated the initial post to support other windows, such like Windows Terminal.
Steffen
Steffen
- 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: 30739
[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...
- 28 Oct 2022 15:06
- Forum: DOS Batch Forum
- Topic: Complete control of cmd windows
- Replies: 88
- Views: 66682
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...
- 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: 30466
[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...