Knows anyone what the problem was? And how it was solved?
Antonio
Search found 1916 matches
- 03 May 2025 10:42
- Forum: DOS Batch Forum
- Topic: …and we’re back!
- Replies: 3
- Views: 2139
- 19 Mar 2025 17:31
- Forum: DOS Batch Forum
- Topic: string replacer for 1 file but it needs looping to replace many OldStrings with NewStrings
- Replies: 2
- Views: 3254
Re: string replacer for 1 file but it needs looping to replace many OldStrings with NewStrings
Ok. There are a couple important details in this problem. The code below is designed to run fast with large input files. The input file is processed each time with one find string and just in the lines that contains the find string . The rest of the input lines are just copied as fast as possible. T...
- 11 Jan 2025 22:08
- Forum: DOS Batch Forum
- Topic: Use Netsh to save ip gw dns to variables for project
- Replies: 6
- Views: 6705
Re: Use Netsh to save ip gw dns to variables for project
Try this: @echo off setlocal FOR /F "tokens=3,*" %%A IN ('netsh interface show interface^|find "Connected"') DO set "conn=%%B" set "IP=" for /F "tokens=2 delims=:" %%a in ('netsh interface ip show address "%conn%" ^| findstr "Address Default"') do ( for %%b in (%%a) do if not defined IP (set "IP=%%b...
- 17 Dec 2024 20:58
- Forum: DOS Batch Forum
- Topic: is this possible?
- Replies: 1
- Views: 6199
Re: is this possible?
Mmm... Your question title is very undescriptive... "is this possible?" (What is possible? In the description you talk about a syntax error)... The problem is that all your variable names, like starter-str includes a dash that is also used for subtract operation in set /A command. You can not do tha...
- 16 Dec 2024 09:55
- Forum: DOS Batch Forum
- Topic: Tokens do not pass after 31, is there some way that i can pass this limit?
- Replies: 6
- Views: 8665
Re: Tokens do not pass after 31, is there some way that i can pass this limit?
I am afraid I don't understand why you use precisely a FOR /F command that requires a tokens=40 switch. There are a lot of different ways to separate the elements of a list. For example, you can separate the elements in an array first, and then easily show the individual array elements. I am aware t...
- 15 Dec 2024 09:22
- Forum: DOS Batch Forum
- Topic: Tokens do not pass after 31, is there some way that i can pass this limit?
- Replies: 6
- Views: 8665
Re: Tokens do not pass after 31, is there some way that i can pass this limit?
You can use the method implemented at this reply.
For a description of the limitations of the FOR /F tokens command, see the reply before that. For a fully description of this matter, review the whole Using many "tokens=..." in FOR /F command in a simple way thread...
Antonio
For a description of the limitations of the FOR /F tokens command, see the reply before that. For a fully description of this matter, review the whole Using many "tokens=..." in FOR /F command in a simple way thread...
Antonio
- 09 Dec 2024 14:14
- Forum: DOS Batch Forum
- Topic: is there a way for echo (coordinate row, coordinate column)?
- Replies: 4
- Views: 8825
Re: is there a way for echo (coordinate row, coordinate column)?
This seems to me as X-Y problem. If you generate the 50 rows in sequential order, you can store the Channel A: rows in an array, and then show the array elements in the same lines of Channel B: rows: @echo off setlocal EnableDelayedExpansion rem Generate Channel A: rows and store they in an array fo...
- 08 Dec 2024 15:21
- Forum: DOS Batch Forum
- Topic: Split a filename containing wildcards in path and name without expanding the wildcards
- Replies: 6
- Views: 8720
Re: Split a filename containing wildcards in path and name without expanding the wildcards
Antonio Your code gives incorrect output for the path: filename=c:\one\two\*\four\*.c path=c:.c\one\two\*\four name=*.c I have made a modified version: . . . . . Mmm... My code fail if there is a name variable before the program run, that is, if you remove the setlocal EnableDelayedExpansion comman...
- 06 Dec 2024 14:33
- Forum: DOS Batch Forum
- Topic: Split a filename containing wildcards in path and name without expanding the wildcards
- Replies: 6
- Views: 8720
Re: Split a filename containing wildcards in path and name without expanding the wildcards
This simple one-liner works no matter the number nor the position of the wildcards: @echo off setlocal EnableDelayedExpansion set "filename=c:\one\two\*\four\*.c" set "fpath=%filename:\=" & set "fpath=!fpath!!name!" & set "name=\%" & set "name=!name:~1!" echo filename=%filename% echo path=%fpath% ec...
- 22 Nov 2024 14:46
- Forum: DOS Batch Forum
- Topic: The Daily Calendar Puzzle
- Replies: 3
- Views: 12228
Re: The Daily Calendar Puzzle
@Saso, Yes... I didn't want to use wmic.exe to get the correct date in any locale so as not to complicate the code further... The whole point of this program is to solve the calendar puzzle... I found a small bug in the definition of pieces 2 and 3, and another when handling dates with day or month ...
- 18 Nov 2024 20:04
- Forum: DOS Batch Forum
- Topic: The Daily Calendar Puzzle
- Replies: 3
- Views: 12228
The Daily Calendar Puzzle
The "Daily Calendar Puzzle" is a toy comprised of a board with squares marked with the Month names, Days numbers and DayOfWeek names, and 10 different pieces that covers most squares, but leaves 3 spaces in the board. The goal of the puzzle is to place the pieces in a way that the 3 spaces correspon...
- 13 Nov 2024 04:11
- Forum: DOS Batch Forum
- Topic: Question about unattended or silent uninstallation
- Replies: 5
- Views: 15461
Re: Question about unattended or silent uninstallation
Try this: @if (@CodeSection == @Batch) @then @echo off rem Use %SendKeys% to send keys to the keyboard buffer set SendKeys=CScript //nologo //E:JScript "%~F0" rem Start the other program in the same Window start "" /B rundll32.exe dfshim.dll,ShArpMaintain ComponentesHarware.application, Culture=neut...
- 11 Nov 2024 11:28
- Forum: DOS Batch Forum
- Topic: Question about unattended or silent uninstallation
- Replies: 5
- Views: 15461
Re: Duda con desinstalación desatendida o silenciosa
You have not indicated the way to provide the confirmation... If it is just the Enter key, try: echo/| rundll32.exe dfshim.dll,ShArpMaintain ComponentesHarware.application, Culture=neutral, PublicKeyToken=b3fd472d4be1fc0f, processorArchitecture=msil If it is a "S" key, try: echo S| rundll32.exe dfsh...
- 09 Oct 2024 16:07
- Forum: DOS Batch Forum
- Topic: date and time format inconsistencies
- Replies: 13
- Views: 58924
Re: date and time format inconsistencies
You can also use my wmiClass.bat program that access the WMI Classes in an efficient way via JScript code. For example: @echo off setlocal EnableDelayedExpansion for /F %%a in ('wmiClass OS LocalDateTime') do set "%%a" echo LocalDateTime=%LocalDateTime% for %%a in ("Year=0,4" "Month=4,2" "Day=6,2" "...
- 04 Oct 2024 16:46
- Forum: DOS Batch Forum
- Topic: How to ramdomly select test cases among the test suite to run daily?
- Replies: 11
- Views: 45007
Re: How to ramdomly select test cases among the test suite to run daily?
goodywp, I am afraid I don't follow you... Hi Aacini, just realized that there are some issue regarding some characters as this From the attached two files, one input.txt and output.txt You can see this code did the job but also did some extra job such as orignal in input.txt = ----> in output.txt b...