Search found 1640 matches

by Aacini
28 Jun 2020 21:14
Forum: DOS Batch Forum
Topic: Creating filenames automatically with X and Y
Replies: 2
Views: 69

Re: Creating filenames automatically with X and Y

@echo off setlocal EnableDelayedExpansion rem Read last values set /P "lastX=X = " set /P "lastY=Y = " rem Generate the desired names set /A X=100 for /L %%X in (1,1,%lastX%) do ( set /A X+=1, Y=100 for /L %%Y in (1,1,%lastY%) do ( set /A Y+=1 echo filename_X!X:~1!_Y!Y:~1!.xxx ) ) Antonio
by Aacini
27 Jun 2020 08:46
Forum: DOS Batch Forum
Topic: JREPL - Combine Data From Two Files By Matching Strings
Replies: 5
Views: 113

Re: JREPL - Combine Data From Two Files By Matching Strings

Thanks, Antonio. I'll provide more information. The files will actually contain thousands of lines each: File 1: 3498=ABC Company 73=First Hospital 78=Best Organization File 2: 3498-0112=General Expenses 73-0001=Bills 73-0292=Documents 78-0003=Human Resources FinalOutput: 3498-0112=General Expenses...
by Aacini
26 Jun 2020 14:01
Forum: DOS Batch Forum
Topic: JREPL - Combine Data From Two Files By Matching Strings
Replies: 5
Views: 113

Re: JREPL - Combine Data From Two Files By Matching Strings

Your question is pretty incomplete; there are a lot of details that are not well defined. However, you don't need JREPL to perform this simple sustitution: @echo off setlocal EnableDelayedExpansion rem Load first-token values from File 1: for /F "tokens=1* delims==" %%a in (File1.txt) do set "compan...
by Aacini
18 Jun 2020 11:35
Forum: DOS Batch Forum
Topic: Pass multiple lines(through stdin) from batch to powershell
Replies: 4
Views: 176

Re: Pass multiple lines(through stdin) from batch to powershell

Try:

Code: Select all

(
echo abc
echo exit
) | Powershell.exe -Noprofile -File test.ps1 
Antonio
by Aacini
18 Jun 2020 11:31
Forum: DOS Batch Forum
Topic: Is it possible to create a variable that will change a data path in a command?
Replies: 3
Views: 149

Re: Is it possible to create a variable that will change a data path in a command?

Code: Select all

set /P "ClientNo=Enter Client Number: "
echo C:\Data\Hosted\Company%ClientNo%\Profiles\
Antonio
by Aacini
15 Jun 2020 16:33
Forum: DOS Batch Forum
Topic: How delayed expansion works?
Replies: 3
Views: 281

Re: How delayed expansion works?

Hi lockedscope, If you want to review some strange things that can be achieved combining %normal% and !delayed! expansions, then I invite you to review this crazy thread ... Antonio PS - Remember that several %%expansions%% can be nested via CALL command, but !delayed! expansion happen just once...
by Aacini
12 Jun 2020 19:14
Forum: DOS Batch Forum
Topic: Batch hex edit offset from filename
Replies: 8
Views: 416

Re: Batch hex edit offset from filename

I think you can solve your problem in a very simple way using my ReadFile.exe auxiliary program: @echo off setlocal EnableDelayedExpansion for %%f in (*.hex) do ( set "file=%%f" < "%%f" ( & rem Redirect input from current file. Stdin handle: 0 ReadFile 0 942 & rem Copy first 0x3AE bytes set /P "=!fi...
by Aacini
11 Jun 2020 19:59
Forum: DOS Batch Forum
Topic: Atan?
Replies: 5
Views: 374

Re: Atan?

I think this is the fastest method to evaluate ATAN with good precision: @echo off setlocal EnableDelayedExpansion rem CORDIC reference: https://bsvi.ru/uploads/CORDIC--_10EBA/cordic.pdf rem Angles: 45.0000 22.5000 11.2500 5.6250 2.8125 1.4062 0.7031 rem Values below are: tan(angle) * 10000 set "Tan...
by Aacini
05 Jun 2020 19:43
Forum: DOS Batch Forum
Topic: Game Of Life
Replies: 19
Views: 991

Re: Game Of Life

. . . . . The store function takes a value and puts it into 1 of 5 storage variables, s0-s4 . . . . . . This entire part counts the current position's neighbours and stores it in s0: store(gtr(col(x-1,y-1),0)+gtr(col(x,y-1),0)+gtr(col(x+1,y-1),0)+gtr(col(x-1,y),0)+gtr(col(x+1,y),0)+gtr(col(x-1,y+1)...
by Aacini
05 Jun 2020 17:09
Forum: DOS Batch Forum
Topic: Game Of Life
Replies: 19
Views: 991

Re: Game Of Life

A different approach based on pure Batch file commands: @echo off setlocal EnableDelayedExpansion rem Density is a value between 0 (minimum) and 9 (maximum) set /A width=60, height=30, density=3, wP1=width+2, hP1=height+2 mode %wP1%,%hP1% title Game of Life - %width% X %height% @ %density% rem Empty...
by Aacini
11 May 2020 07:41
Forum: DOS Batch Forum
Topic: able to run functions from another script?
Replies: 4
Views: 699

Re: able to run functions from another script?

You may also use the method fully described at this post : ( rem Switch the context to the library file ren "%0" orig-main.bat ren Library.bat "%0" rem Call any function from the library. I.e.: call :anyFunction same parameters rem Switch the context back to the original file ren "%0" Library.bat re...
by Aacini
04 May 2020 08:16
Forum: DOS Batch Forum
Topic: Shift and %*
Replies: 5
Views: 2141

Re: Shift and %*

This method preserve original non-quoted spaces between parameters: @echo off setlocal EnableDelayedExpansion set "all=%*" set "restAfterFirst=!all:*%1=!" echo All: [%*] echo First: [%1] echo Rest: [!restAfterFirst!] Output: C:/test> test one two three four All: [one two three four] First: [one] Res...
by Aacini
25 Apr 2020 05:33
Forum: DOS Batch Forum
Topic: Doskey batch file command not working with cmd shortcut
Replies: 1
Views: 1161

Re: Doskey batch file command not working with cmd shortcut

If you read the description of DOSKEY /? command, it says something like "Edit command lines and creates macros". Again: it works on command lines . What a "command line" is? Is the line that you create when you type in keyboard keys using your fingers at the command prompt. The lines placed in a Ba...