<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; CMD/BAT: Переменная в переменной]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=14007&amp;type=atom" />
	<updated>2018-08-04T18:36:47Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=14007</id>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Переменная в переменной]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=127692#p127692" />
			<content type="html"><![CDATA[<p>Это так просто! Большое спасибо! Теперь буду знать</p>]]></content>
			<author>
				<name><![CDATA[Александр_foxware]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26976</uri>
			</author>
			<updated>2018-08-04T18:36:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=127692#p127692</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Переменная в переменной]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=127691#p127691" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>@echo off
setlocal enableextensions enabledelayedexpansion

set name1=one
set name2=two

set one_param1=target_clock
set one_param2=target_place

set two_param1=target_day
set two_param2=target_year

echo !%name1%_param1!

endlocal
exit /b 0
</code></pre></div><p>Ключевым здесь является enabledelayedexpansion и использование символов ! для отложенного раскрытия переменной окружения, получающейся при раскрытии переменной окружения name1.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2018-08-04T18:08:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=127691#p127691</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Переменная в переменной]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=127687#p127687" />
			<content type="html"><![CDATA[<p>Ошибся с примером. Исправил в первом сообщении</p>]]></content>
			<author>
				<name><![CDATA[Александр_foxware]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26976</uri>
			</author>
			<updated>2018-08-04T17:00:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=127687#p127687</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Переменная в переменной]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=127686#p127686" />
			<content type="html"><![CDATA[<p>Ваш пример ничего не объясняет. Ну, заменим мы %name1% на one, и что — у Вас нет переменной окружения one_param1.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2018-08-04T15:29:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=127686#p127686</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[CMD/BAT: Переменная в переменной]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=127685#p127685" />
			<content type="html"><![CDATA[<p>Приветствую! Столкнулся с вопросом использования переменной в переменной:</p><div class="codebox"><pre><code>set name1=one
set name2=two

set one_param1=target_clock
set one_param2=target_place

set two_param1=target_day
set two_param2=target_year



echo %%name1%_param1%</code></pre></div><p>Никак не могу понять как вызывать переменную если в имени переменной есть также переменная. Вроде должно быть просто. Подскажите пожалуйста.</p>]]></content>
			<author>
				<name><![CDATA[Александр_foxware]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26976</uri>
			</author>
			<updated>2018-08-04T14:49:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=127685#p127685</id>
		</entry>
</feed>
