<?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=14404&amp;type=atom" />
	<updated>2018-12-12T22:25:40Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=14404</id>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Преоброзование кирилицы в латиницу]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130390#p130390" />
			<content type="html"><![CDATA[<p>Например так (проверялось только в части замены символов):<br /></p><div class="codebox"><pre><code>@echo off
setlocal enableextensions enabledelayedexpansion

set /p sNewFolderName=Часть имени для нового каталога: 
call :Cyr2Lat &quot;%sNewFolderName%&quot; &amp;&amp; (
	2&gt;nul md &quot;d:\Today\2018-12-12 !Cyr2Lat!&quot;
	xcopy.exe &quot;c:\Users\Sifat\Downloads&quot; &quot;D:\Today\2018-12-12 !Cyr2Lat!\&quot;
	del &quot;c:\Users\Sifat\Downloads\*.*&quot; /s /q
)

endlocal
exit /b 0

:Cyr2Lat
	setlocal enableextensions enabledelayedexpansion

	set sOut=%~0
	set sText=%*
	
	if not defined sText (
		echo Need parameter
		exit /b 1
	)
	set sText=%sText:~1,-1%

	set sText=%sText:а=a%
	set sText=%sText:б=b%
	set sText=%sText:в=v%
	set sText=%sText:г=g%
	set sText=%sText:д=d%
	set sText=%sText:е=e%
	set sText=%sText:ё=jo%
	set sText=%sText:ж=zh%
	set sText=%sText:з=z%
	set sText=%sText:и=i%
	set sText=%sText:й=j%
	set sText=%sText:к=k%
	set sText=%sText:л=l%
	set sText=%sText:м=m%
	set sText=%sText:н=n%
	set sText=%sText:о=o%
	set sText=%sText:п=p%
	set sText=%sText:р=r%
	set sText=%sText:с=s%
	set sText=%sText:т=t%
	set sText=%sText:у=u%
	set sText=%sText:ф=f%
	set sText=%sText:х=h%
	set sText=%sText:ц=ts%
	set sText=%sText:ч=ch%
	set sText=%sText:ш=sh%
	set sText=%sText:щ=sch%
	set sText=%sText:ъ=&#039;&#039;%
	set sText=%sText:ы=i%
	set sText=%sText:ь=&#039;%
	set sText=%sText:э=eh%
	set sText=%sText:ю=ju%
	set sText=%sText:я=ja%

	endlocal &amp; set %sOut:~1%=%sText%
	exit /b 0
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2018-12-12T22:25:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130390#p130390</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[CMD/BAT: Преоброзование кирилицы в латиницу]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130372#p130372" />
			<content type="html"><![CDATA[<p>Здравствуйте народ...есть у меня такой вот маленький батник<br /></p><div class="codebox"><pre><code>@echo off
set /P pset= &quot;Nazvanie papki: &quot;
echo %pset%
MD D:\Today\&quot;2018-12-12 %pset%&quot;
XCOPY C:\Users\Sifat\Downloads D:\Today\&quot;2018-12-12 %pset%&quot;\
del &quot;C:\Users\Sifat\Downloads\*.*&quot; /s /q
</code></pre></div><p>который просит ввести название папки...и создаёт папку с названием &quot;2018-12-12 ТЕКСТ КОТОРЫЙ БЫЛ ВВЕДЕН В КОМАНДНУЮ СТРОКУ&quot;<br />после копирует файлы с папки загрузки в данную папку, после удаляет всё, что есть&nbsp; в папке загрузки..<br />так вот...Я должен создавать папки в латинице...мне приходится вручную писать в латинице название папок...название папок, это Имена и фамилии клиентов....т.е. имена клиентов у меня есть в кирилице...я хочу их ввести в командную строку так же в кирилице, что-бы командная строка создала папку в латинице....нашёл в форуме этом,такой вот код...но никак не смог понять суть, как мне это &quot;чудо&quot; добавить в свой батник..<br /></p><div class="codebox"><pre><code>@echo off 
if &quot;%*&quot;==&quot;&quot; goto :eof
if not exist %1 goto istext

setlocal  enabledelayedexpansion
for /f &quot;delims=&quot; %%a in (%1) do (
    set words=%%a
    set words=!words:а=a!
    set words=!words:б=b!
    set words=!words:в=v!
    set words=!words:г=g!
    set words=!words:д=d!
    set words=!words:е=e!
    set words=!words:ё=jo!
    set words=!words:ж=zh!
    set words=!words:з=z!
    set words=!words:и=i!
    set words=!words:й=j!
    set words=!words:к=k!
    set words=!words:л=l!
    set words=!words:м=m!
    set words=!words:н=n!
    set words=!words:о=o!
    set words=!words:п=p!
    set words=!words:р=r!
    set words=!words:с=s!
    set words=!words:т=t!
    set words=!words:у=u!
    set words=!words:ф=f!
    set words=!words:х=h!
    set words=!words:ц=ts!
    set words=!words:ч=ch!
    set words=!words:ш=sh!
    set words=!words:щ=sch!
    set words=!words:ъ=&#039;&#039;!
    set words=!words:ы=i!
    set words=!words:ь=&#039;!
    set words=!words:э=eh!
    set words=!words:ю=ju!
    set words=!words:я=ja!

    echo !words!
)
endlocal

exit /b

:istext
set word=%*
set word=%word:а=a%
SET word=%word:б=b%
SET word=%word:в=v%
SET word=%word:г=g% 
SET word=%word:д=d%
SET word=%word:е=e%
SET word=%word:ё=jo% 
SET word=%word:ж=zh% 
SET word=%word:з=z% 
SET word=%word:и=i% 
SET word=%word:й=j% 
SET word=%word:к=k% 
SET word=%word:л=l% 
SET word=%word:м=m% 
SET word=%word:н=n% 
SET word=%word:о=o% 
SET word=%word:п=p% 
SET word=%word:р=r% 
SET word=%word:с=s% 
SET word=%word:т=t% 
SET word=%word:у=u% 
SET word=%word:ф=f% 
SET word=%word:х=h%
SET word=%word:ц=ts% 
SET word=%word:ч=ch% 
SET word=%word:ш=sh% 
SET word=%word:щ=sch%
SET word=%word:ъ=&quot;% 
SET word=%word:ы=y% 
SET word=%word:ь=`% 
SET word=%word:э=e% 
SET word=%word:ю=ju% 
SET word=%word:я=ja%

echo %word%</code></pre></div>]]></content>
			<author>
				<name><![CDATA[i_parviz]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39722</uri>
			</author>
			<updated>2018-12-12T12:13:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130372#p130372</id>
		</entry>
</feed>
