문제

Okay, so I'm trying to make a program that "understands" user input and does what they tell it to do. People usually just use specific commands such as "open this file" and it only works if the user types EXACTLY that. I'm trying to give my users a little bit of leeway, so that they can type something like what they want to happen, and the computer will get the general idea. With that block of rambling aside, I've run into a problem.

set word%wordNum%=%word%
:fileExtension
set extChk= %letterNum% - 2 REM Includes the period of the extension
call set extension=%%_albaiRec:~%extChk%,4%%
::extChk is checking for a period so the program will recognize a file extension
set file=

That last line is where I get stuck... I'm trying to use that last recorded word variable.

set var=7
set word7=Wanted text
echo %word%var%%

Sorta like that?

도움이 되었습니까?

해결책

Add setLocal enableDelayedExpansion to the start of your script.

Then replace echo %word%var%% with echo !word%var%!.

For more information - http://ss64.com/nt/delayedexpansion.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top