Search found 554 matches

by miskox
17 Jun 2023 13:19
Forum: DOS Batch Forum
Topic: Script issue on "FINDSTR"
Replies: 7
Views: 2086

Re: Script issue on "FINDSTR"

Strange. See this what I get on my computer: c:\REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion"|find /i "product" ProductName REG_SZ Windows 10 Enterprise c:\>wmic os get Caption Caption Microsoft Windows 10 Pro c:\>systeminfo|find /i "os name" OS Name: Microsoft Windows 10 Pro c:\> Saso
by miskox
13 Jun 2023 11:06
Forum: DOS Batch Forum
Topic: How to convert argument list to skip first argument?
Replies: 5
Views: 2310

Re: How to convert argument list to skip first argument?

How do you get this list?

Code: Select all

@echo off
echo %*

set par_list=&rem
:0
shift
set par_list=%par_list% %1
if not "%2"=="" goto :0

echo %par_list%
Output:

Code: Select all

c:\>some_bat.cmd "a" "b" "c" "d"
"a" "b" "c" "d"
 "b" "c" "d"
c:\>
viewtopic.php?p=38525#p38525

Saso
by miskox
11 Jun 2023 10:26
Forum: DOS Batch Forum
Topic: cmd-Terminal menu: How to iterate a number of spaces given in a variable into another variable?
Replies: 5
Views: 1705

Re: cmd-Terminal menu: How to iterate a number of spaces given in a variable into another variable?

@miskox Is it possible to include the string length (string manipulation) from a variable to automate it? Use this: @echo off set txt=The quick brown fox jumps over the lazy dog. echo 1 2 3 4 echo 12345678901234567890123456789012345678901234 echo The quick brown fox jumps over the lazy dog. echo --...
by miskox
11 Jun 2023 10:09
Forum: DOS Batch Forum
Topic: nested IF statements, best practice (newbie question)
Replies: 5
Views: 1869

Re: nested IF statements, best practice (newbie question)

After some thinking: the long IF will not work correctly. It will work if *all* files are missing and not if there is at least one file present. Maybe you could use this: @echo off REM create temporary files break>a.a break>b.b break>c.c REM list files here: set file_list=a.a b.b&rem REM if there ar...
by miskox
09 Jun 2023 04:47
Forum: DOS Batch Forum
Topic: Combinations of N numbers in sets of K with R repeated elements
Replies: 9
Views: 3405

Re: Combinations of N numbers in sets of K with R repeated elements

Congratulations Antonio! I must admit that I don't understand what are you talking (writing) about but it was an interesting to read it. . . . Saso Mmm... Why is that? Although English is not my milk tongue, I try to write as clear as possible! When I have a doubt about my writting, I used a web tr...
by miskox
09 Jun 2023 04:43
Forum: DOS Batch Forum
Topic: nested IF statements, best practice (newbie question)
Replies: 5
Views: 1869

Re: nested IF statements, best practice (newbie question)

One of the options is (because looks like you don't have filenames changing all the time): set files_exist=0 if exist libiconv2.dll if exist libintl3.dll if exist libcharset1.dll set files_exist=1 and then you just check for 'files_exist' variable. You say all of the echoed messages are for troubles...
by miskox
07 Jun 2023 23:44
Forum: DOS Batch Forum
Topic: cmd-Terminal menu: How to iterate a number of spaces given in a variable into another variable?
Replies: 5
Views: 1705

Re: cmd-Terminal menu: How to iterate a number of spaces given in a variable into another variable?

You could use something like this: @echo off set text1=Some text&rem set text2=Some more text&rem set text3=Additional text&rem set field1=%text1% &rem 20 spaces set field2=%text2% &rem 25 spaces set field3=%text3% &rem 30 spaces set field1=%field1:~0,20% set field2=%field2:~0,25% set field3=%field3...
by miskox
03 Jun 2023 13:26
Forum: DOS Batch Forum
Topic: Combinations of N numbers in sets of K with R repeated elements
Replies: 9
Views: 3405

Re: Combinations of N numbers in sets of K with R repeated elements

Congratulations Antonio! I must admit that I don't understand what are you talking (writing) about but it was an interesting to read it. I am always amazed with the solutions you have (I remember that clever solution for that very loooong XML schema https://www.dostips.com/forum/viewtopic.php?f=3&t=...
by miskox
05 May 2023 07:07
Forum: DOS Batch Forum
Topic: create macro: Let's create a small handout with reports .
Replies: 17
Views: 5350

Re: create macro: Let's create a small handout with reports .

2jeb: thank you for this looong post of useful links. I will take a look at them too. I am having troubles understanding macros aswell. Will check them. I think it is time for me to try and use them.

Saso
by miskox
04 May 2023 06:55
Forum: DOS Batch Forum
Topic: Notepad bug
Replies: 10
Views: 9511

Re: Notepad bug

https://answers.microsoft.com/en-us/windows/forum/all/notepadexe-command-line-options/810760c1-a45a-4013-9544-1c1208e1b389 /A <filename> open file as ansi /W <filename> open file as unicode /P <filename> print filename /PT <filename> <printername> <driverdll> <port> print filename to designated prin...
by miskox
23 Mar 2023 12:27
Forum: DOS Batch Forum
Topic: Read window line from parent cmd without writing to file
Replies: 6
Views: 2551

Re: Read window line from parent cmd

Run pmon.exe only and post the results (between code tags, please).

Saso
by miskox
23 Mar 2023 06:24
Forum: DOS Batch Forum
Topic: Read window line from parent cmd without writing to file
Replies: 6
Views: 2551

Re: Read window line from parent cmd

What happens if you remove the 'start' command?

Code: Select all

for /f "usebackq tokens=2 delims=: " %i in (`pmon.exe ^|findstr /i "memory"`) do echo %i
Saso
by miskox
28 Feb 2023 06:41
Forum: DOS Batch Forum
Topic: If Exist then Delete
Replies: 1
Views: 1268

Re: If Exist then Delete

Add

Code: Select all

del /f /q F:\Finances\CSOB\XLK_WorkSheets2023\*.xlk
if you want to delete files first.

Saso
by miskox
08 Jan 2023 10:16
Forum: DOS Batch Forum
Topic: Exporting two keys from Registry residing in two different places on Windows 10
Replies: 9
Views: 16886

Re: Exporting two keys from Registry residing in two different places on Windows 10

Some changes to Lucky's solution: @echo off reg export "HKEY_CURRENT_USER\Console" "%userprofile%\Documents\CMD _ PowerShell Settings.reg" reg export "HKEY_USERS\S-1-5-21-3797103458-798797042-3558267449-1001\Console" "%userprofile%\Documents\1.reg" type "%userprofile%\Documents\1.reg" | find /v "Win...