Search found 1620 matches

by Aacini
05 Apr 2019 09:55
Forum: DOS Batch Forum
Topic: how to make an array by function and by local variable of the function
Replies: 5
Views: 1553

Re: how to make an array by function and by local variable of the function

@echo off set /a n=99 call :test3 ret echo show array: echo %ret.Array[0]% echo %ret.Array[1]% echo %ret.Array[2]% echo %ret.Array[3]% ECHO Press any key to close the windows... pause>NUL goto :eof :test3 setlocal for /L %%i in (0,1,3) do set "%~1.Array[%%i]=V%%i" set localEnv=1 for /F %%v in ('set...
by Aacini
05 Apr 2019 09:44
Forum: DOS Batch Forum
Topic: Convert 1111 2222 3333 in \x11\x11\x22\x22\x33\x33
Replies: 9
Views: 2161

Re: Convert 1111 2222 3333 in \x11\x11\x22\x22\x33\x33

... and you also should read the very first post in this forum... @echo off setlocal EnableDelayedExpansion (for /F "delims=" %%a in (input.txt) do ( set "line=" for %%b in (%%a) do ( set "num=%%b" set "line=!line!\x!num:~0,2!\x!num:~2! ) echo !line! )) > output.txt move /Y output.txt input.txt Anto...
by Aacini
04 Apr 2019 14:26
Forum: DOS Batch Forum
Topic: Lag methodology
Replies: 9
Views: 2359

Re: Lag methodology

That code allows you to generate a series of dates in both upward (future dates) and downward (past dates) from a base date.

Antonio
by Aacini
02 Apr 2019 07:19
Forum: DOS Batch Forum
Topic: Lag methodology
Replies: 9
Views: 2359

Re: Lag methodology

by Aacini
28 Mar 2019 13:17
Forum: DOS Batch Forum
Topic: Need help with a game
Replies: 2
Views: 994

Re: Need help with a game

Something like this, perhaps? @echo off setlocal EnableDelayedExpansion set "Answer1.1=Hello Roger, I am the employee responsible for your file" set "Answer1.2=I will not go there four ways, you will die if you do not convince me otherwise^!" set "Answer1.3=Terminate these questions" cls :loop echo/...
by Aacini
20 Mar 2019 10:29
Forum: DOS Batch Forum
Topic: Generating consecutive dates
Replies: 1
Views: 872

Generating consecutive dates

In some Batch-file applications the generation of consecutive dates is needed. The usual way to solve this problem is converting the base date to a Julian Day Number, increment/decrement this number by one and then convert it back to date. Other suggested method is using other languages that nativel...
by Aacini
19 Mar 2019 16:24
Forum: DOS Batch Forum
Topic: Lag methodology
Replies: 9
Views: 2359

Re: Lag methodology

I would like to present a simpler approach: @echo off setlocal EnableDelayedExpansion set /P "YYYYMMDD=Enter date in YYYYMMDD format: " set /P "days=Enter number of days: " set /A "DD=100+(D=YYYYMMDD%%100), YYYYMM=YYYYMMDD/100, MM=100+(M=YYYYMM%%100), YYYY=YYYYMM/100 for /L %%i in (1,1,%days%) do ( ...
by Aacini
14 Mar 2019 09:34
Forum: DOS Batch Forum
Topic: Is this possible to be done?
Replies: 2
Views: 853

Re: Is this possible to be done?

Code: Select all

@echo off
setlocal EnableDelayedExpansion

set "reply[0]=Down" & set "reply[1]=Live"

(for /L %%i in () do (
   ping nonsense.com >nul
   call echo %%reply[!errorlevel!]%%
) > logfile.txt
Antonio
by Aacini
12 Mar 2019 10:01
Forum: DOS Batch Forum
Topic: Setting a variable value to single whitespace
Replies: 6
Views: 1374

Re: Setting a variable value to single whitespace

I am afraid you have a confusion here... In Batch files, a variable can be undefined , that is, it does not exists (like in set "var=" ), or it can contain any string, including a blank space (like in set "var= " ). In any case, the variable !expansion! replaces it by the variable value: nothing if ...
by Aacini
04 Mar 2019 09:14
Forum: DOS Batch Forum
Topic: Cardioid - Heart Curve
Replies: 6
Views: 1388

Re: Cardoid - Heart Curve

Interesting! https://i.imgur.com/nRzf0qj.jpg @echo off setlocal EnableDelayedExpansion for /F %%a in ('echo prompt $E^| cmd') do set "ESC=%%a" set "_SIN=a-a*a/1920*a/312500+a*a/1920*a/15625*a/15625*a/2560000-a*a/1875*a/15360*a/15625*a/15625*a/16000*a/44800000" set "SIN=(a=((x) * 31416 / 180)%%62832,...
by Aacini
04 Mar 2019 08:50
Forum: DOS Batch Forum
Topic: Cardioid - Heart Curve
Replies: 6
Views: 1388

Re: Cardoid - Heart Curve

Ops! You are using ANSI sequences to move the cursor... :(

This just works in Windows 10, or with an ANSI driver installed. :cry:

Antonio
by Aacini
01 Mar 2019 09:59
Forum: DOS Batch Forum
Topic: How to eliminate the spaces in a line in a text file
Replies: 9
Views: 1846

Re: How to eliminate the spaces in a line in a text file

Simpler: @echo off setlocal EnableDelayedExpansion (for /F "delims=" %%a in (input.txt) do ( set "input=%%a" if "!input:~40!" equ "" ( echo(!input! ) else ( set "output=!input:~0,1!" if "!output!" neq " " set "output=" for %%b in (!input!) do set "output=!output!%%b " echo(!output:~0,-1! ) )) > outp...
by Aacini
28 Feb 2019 20:06
Forum: DOS Batch Forum
Topic: How to eliminate the spaces in a line in a text file
Replies: 9
Views: 1846

Re: How to eliminate the spaces in a line in a text file

Several comments about your "question": Your example is incorrect. Line 1 is 78 chars, not < 40 I suppose that with "replace all the spaces with single space" you really want to say "replace all groups of adjacent spaces with single space". If so, then: Lines 4 and 5 in the output example are wrong,...
by Aacini
13 Feb 2019 09:38
Forum: DOS Batch Forum
Topic: Set Window Topmost (Powershell hybrids)
Replies: 4
Views: 1207

Re: Set Window Topmost (Powershell hybrids)

You may precompile all DLL files and keep the class definitions open in a resident PowerShell code, so the posterior usage of the Windows API's is very fast. The technique is described at Read arrow keys and show color text in an efficient way.

Antonio