Search found 3979 matches

by aGerman
13 Jun 2021 07:18
Forum: DOS Batch Forum
Topic: Display .BMP files in RGB colors - WIN 10 ONLY
Replies: 5
Views: 1820

Re: Display .BMP files in RGB colors - WIN 10 ONLY

Vats,

If "Public Domain" is not a legal possibility in your country, take "CC0". In other words, feel free to do whatever you wan't with the code. Credits not necessary (unless you want to tell the users of your game who to blame :lol:).

Steffen
by aGerman
10 Jun 2021 13:52
Forum: DOS Batch Forum
Topic: Get cursor position
Replies: 5
Views: 136

Re: Get cursor position

... native batch? No. But why so complicated? You use PowerShell anyway. @echo off title Get cursor echo( echo( echo( pause>nul|set/p =Fourth line, 29th character: for /f "tokens=1*" %%i in ( 'powershell.exe -nop -ep Bypass -c "$pos=$host.UI.RawUI.CursorPosition;(''+($pos.X+1)+' '+($pos.Y+1))"' ) d...
by aGerman
10 Jun 2021 11:57
Forum: DOS Batch Forum
Topic: FINDSTR \s regexp meaning
Replies: 4
Views: 96

Re: FINDSTR \s regexp meaning

Yeah, also my expectation is that the backslash is simply ignored and findstr tries to match the s in each line. Tested in a cmd window: D:\test>(echo qwe&echo asd&echo yxc)|findstr /r "\s" asd D:\test> Certainly this thread on SO is more enlightening as to further behavior of findstr: https://stack...
by aGerman
10 Jun 2021 03:11
Forum: DOS Batch Forum
Topic: FINDSTR \s regexp meaning
Replies: 4
Views: 96

Re: FINDSTR \s regexp meaning

Well, you provided some commands. But you didn't tell what output you get, and what output you expected to get. I mean, the findstr command on Windows is probably the tool with the worst regex support out of all regex tools that I know. So, in case you expect that \s will match a whitespace and \t w...
by aGerman
06 Jun 2021 06:02
Forum: DOS Batch Forum
Topic: Improvements to my tools supporting multiple encodings
Replies: 3
Views: 253

Re: Improvements to my tools supporting multiple encodings

Jean-François, I spent some hours to figure out how to improve the encoding detection. The ability of IMultiLanguage2::DetectInputCodepage to distinguish between different SBCS and DBCS is quite promising. Attached you'll find the compiled tool, source code and test files. I guess distinguishing bet...
by aGerman
03 Jun 2021 10:32
Forum: DOS Batch Forum
Topic: Improvements to my tools supporting multiple encodings
Replies: 3
Views: 253

Re: Improvements to my tools supporting multiple encodings

Tried encoding.exe. My default ANSI CP is 1252 and the OEM CP 850 "a.txt" Windows-1251 encoded file Выбрать из массива элемент, называемый опорным. Это может быть любой из элементов массива. От выбора опорного элемента не зависит корректность алгоритма, но в отдельных случаях может сильно зависеть е...
by aGerman
03 Jun 2021 05:16
Forum: DOS Batch Forum
Topic: Improvements to my tools supporting multiple encodings
Replies: 3
Views: 253

Re: Improvements to my tools supporting multiple encodings

Jean-François, Meanwhile the Windows console is almost ready for emojis. However, right now they are still not supported. Related issue: https://github.com/microsoft/terminal/issues/190 You will likely have luck using the new Windows Terminal. Microsoft is about to give you the opportunity to enable...
by aGerman
27 May 2021 10:33
Forum: DOS Batch Forum
Topic: package manager
Replies: 2
Views: 290

Re: package manager

Package Manager:
packagemgr.jpg
packagemgr.jpg (95.18 KiB) Viewed 273 times
(Sorry, couldn't resist. I mean, wow, this is certainly the most minimalistic post I've ever seen on DosTips. Would you mind to at least leave one sentence what you get if you follow the link and why it's worth to check this out? Thanks! Steffen)[/size]
by aGerman
23 May 2021 15:01
Forum: DOS Batch Forum
Topic: Print an array elements based on an input param
Replies: 2
Views: 292

Re: Print an array elements based on an input param

Use the SET /P trick. It prints a string without new line.

Code: Select all

@echo off
setlocal enabledelayedexpansion
set w[0]=1
set w[1]=2
set w[2]=3
set w[3]=4
set w[4]=5

call :printArray 3
pause
exit /b

:printArray %1
set /a "n=%1-1"
for /l %%i in (0 1 %n%) do <nul set /p "=!w[%%i]! "
echo(
exit /b
Steffen
by aGerman
19 May 2021 14:19
Forum: DOS Batch Forum
Topic: Need help clearing a log while it is being written to (CMD)
Replies: 4
Views: 395

Re: Need help clearing a log while it is being written to (CMD)

You're likely out of luck unless you can change the behavior of how the process which writes firstlog.log opens the file, or if you terminate this process. Windows allows a process to open a file in different modes. This does not only affect the own access of the file, but also the access shared wit...
by aGerman
15 May 2021 04:59
Forum: DOS Batch Forum
Topic: Run program with different methods in loops
Replies: 3
Views: 442

Re: Run program with different methods in loops

At least you would need to run 3 cmd.exe processes. They may run all from within the same batch file and they may all run in the same console window. Something about like that: @echo off cd C:\ProgramFolder\ start /b cmd /c "for /l %%i in () do start /b /wait program -m method1" start /b cmd /c "for...
by aGerman
14 May 2021 12:33
Forum: DOS Batch Forum
Topic: CmdBkg - use bitmap as background to console window
Replies: 75
Views: 40117

Re: CmdBkg - use bitmap as background to console window

Unfortunately there is no possiblity. The way CmdBkg works is like that: There are two windows. The foreground window is the console window which displays the text. The background window displays the image and it lays behind the console window (following the position and size updates of the console ...
by aGerman
06 May 2021 14:10
Forum: DOS Batch Forum
Topic: Batch script to delete .txt files in all subfolders except one
Replies: 4
Views: 616

Re: Batch script to delete .txt files in all subfolders except one

Remove option /S from the DEL command. My fault.
The script will exclude all paths which contain string "\Documents\Folder1\Subfolder1". This integrates the exclusion of any subfolder structure underneath "Subfolder1". If this is not the intended behavior, I still don't get it.

Steffen
by aGerman
05 May 2021 15:25
Forum: DOS Batch Forum
Topic: How do i use RoboCopy where the destination is pinpointed with the name of a file?
Replies: 1
Views: 456

Re: How do i use RoboCopy where the destination is pinpointed with the name of a file?

Code: Select all

FOR %%i IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST "%%i:\usb_stick.txt" robocopy "%%i:\." "E:\Data\USB Stick" /MIR
Just my guess.

Steffen
by aGerman
05 May 2021 15:19
Forum: DOS Batch Forum
Topic: Batch script to delete .txt files in all subfolders except one
Replies: 4
Views: 616

Re: Batch script to delete .txt files in all subfolders except one

I guess something like that should do the trick:

Code: Select all

for /f "delims=" %%i in ('dir /ad /b /s "%userprofile%\Documents"^|find /i /v "\Documents\Folder1\Subfolder1"') do del /f /s /q "%%i\*.xml"
Steffen