1
我無法訪問下面示例中存儲的值。我需要訪問存儲在變量中的值,但變量名稱存儲在另一個變量中。請幫忙。批處理腳本 - 如何使用存儲變量名的其他變量獲取變量值
實施例:
setlocal enabledelayedexpansion
set a222333password=hellopass
for %%i in (%fileserver%\t*) do (
set currentfilename=%%~ni --> file name is "t222333"
set currentlogin=!currentfilename:t=a! --> login is "a222333"
set currentpasswd=!!currentlogin!password! --> password should be "hellopass"
echo !currentpasswd! --> this gives me the value "a222333password" instead of "hellopass"
)
這種類型的管理解釋在[這個答案](https://stackoverflow.com/questions/10166386/arrays-linked-lists-and-other-data-structures-in-cmd-exe-batch -script/10167990#10167990),但主題不同。 – Aacini