L
L
lik1732021-02-14 19:15:18
cmd/bat
lik173, 2021-02-14 19:15:18

How to display line by line elements with one extension in a folder into variables?

There is a bat file and a folder
You need to do something like this:
In the folder: abc.bat, habr.bat, file, notdisplay.vbs
Display only batch files (abc.bat, habr.bat) in variables,
Delete 4 letters from the back (.bat)

and preferably, when adding files, variables of the type were created:
% punkt1%
% punkt2%
% punkt3%
, etc.

And later use it in cmdmenusel

Is this possible?
If so, how?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wisgest, 2021-02-14
@lik173

See help for commands SETand FOR:

setlocal enabledelayedexpansion
set /a "i = 0"
for %%i in ("*.bat") do (
  set /a "i += 1"
  set "punkt!i!=%%~ni"
)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question