<?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=6567&amp;type=atom" />
	<updated>2011-12-20T02:54:05Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=6567</id>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Список дисков]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=54793#p54793" />
			<content type="html"><![CDATA[<p>сто лет небыл на форуме<br />внесу свои 3 копейки<br /></p><div class="codebox"><pre><code>for /f &quot;usebackq tokens=1,* delims=: &quot; %i in (`mountvol^|find /i &quot;:\&quot;`) do @echo %i &gt;&gt;disks.txt</code></pre></div><p>если внутри скрипта, то<br /></p><div class="codebox"><pre><code>@echo off
for /f &quot;usebackq tokens=1,* delims=: &quot; %%i in (`mountvol^|find /i &quot;:\&quot;`) do echo %%i &gt;&gt;disks.txt</code></pre></div>]]></content>
			<author>
				<name><![CDATA[VitAliS]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24943</uri>
			</author>
			<updated>2011-12-20T02:54:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=54793#p54793</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Список дисков]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=54753#p54753" />
			<content type="html"><![CDATA[<p>Спасибо alexii ! <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /><br />Все получилось, ура!</p>]]></content>
			<author>
				<name><![CDATA[nouser]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27437</uri>
			</author>
			<updated>2011-12-18T20:59:54Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=54753#p54753</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Список дисков]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=54752#p54752" />
			<content type="html"><![CDATA[<p>Угу. Нет его в данной версии. Можете использовать следующий подход: взять код на WSH и исполнить его, перенаправив вывод в файл.</p><p>1. Сохранить любой из двух кодов:<br /></p><div class="codebox"><pre><code>Option Explicit

Dim objSWbemObjectEx

With WScript.CreateObject(&quot;WbemScripting.SWbemLocator&quot;).ConnectServer(&quot;.&quot;, &quot;root\cimv2&quot;)
    For Each objSWbemObjectEx In .ExecQuery(&quot;SELECT Name FROM Win32_LogicalDisk WHERE DriveType=3&quot;)
        WScript.Echo objSWbemObjectEx.Name
    Next
End With

WScript.Quit 0</code></pre></div><p>или:<br /></p><div class="codebox"><pre><code>Option Explicit

Const Fixed = 2

Dim objDrive

For Each objDrive In WScript.CreateObject(&quot;Scripting.FileSystemObject&quot;).Drives
    If objDrive.DriveType = Fixed Then
        WScript.Echo objDrive.Path
    End If
Next

WScript.Quit 0</code></pre></div><p>в файл «GetHardDiskLetters.vbs».</p><p>2. Исполнить его посредством «cscript.exe», перенаправив вывод в файл:<br /></p><div class="codebox"><pre><code>cscrpipt.exe //nologo &quot;GetHardDiskLetters.vbs&quot;&gt;&quot;0001.txt&quot;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2011-12-18T20:56:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=54752#p54752</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Список дисков]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=54750#p54750" />
			<content type="html"><![CDATA[<p>Красиво, подскажите только, где взять wmic.exe (на вин 7 типа установлен, на ХР Home нету)? Чет на сайте Майкрософт не могу найти его...<br />Да, может кто-нить совместить это с кодом, приведенным тут: <a href="http://forum.script-coding.com/viewtopic.php?id=2328">http://forum.script-coding.com/viewtopic.php?id=2328</a></p>]]></content>
			<author>
				<name><![CDATA[nouser]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27437</uri>
			</author>
			<updated>2011-12-18T20:38:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=54750#p54750</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Список дисков]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=54740#p54740" />
			<content type="html"><![CDATA[<p>Коллеги, знающие о команде WMIC, показали краткое и красивое решение.</p>]]></content>
			<author>
				<name><![CDATA[Rumata]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24846</uri>
			</author>
			<updated>2011-12-18T11:42:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=54740#p54740</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Список дисков]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=54730#p54730" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>&gt;nul copy nul 0001.txt &amp; for /f &quot;skip=1&quot; %i in (&#039;wmic.exe LogicalDisk where &quot;DriveType=3&quot; get Name&#039;) do @(echo %i&gt;&gt;0001.txt)</code></pre></div><p>Внутри пакетного файла:<br /></p><div class="codebox"><pre><code>@echo off
setlocal enableextensions enabledelayedexpansion

set sFile=0001.txt

if exist &quot;%sFile%&quot; &gt;nul copy nul

for /f &quot;skip=1&quot; %%i in (&#039;wmic.exe LogicalDisk where &quot;DriveType=3&quot; get Name&#039;) do echo %%i&gt;&gt;%sFile%

endlocal
exit /b 0</code></pre></div><p>P.S. Опоздал <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" />.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2011-12-17T22:03:20Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=54730#p54730</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Список дисков]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=54729#p54729" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>for /f &quot;skip=1 delims=:&quot; %%a in (&#039;&quot;wmic logicaldisk where (drivetype=&quot;3&quot;) get Caption&quot;&#039;) do echo:%%a&gt;&gt;harddisks.txt</code></pre></div>]]></content>
			<author>
				<name><![CDATA[!k]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26608</uri>
			</author>
			<updated>2011-12-17T21:44:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=54729#p54729</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Список дисков]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=54725#p54725" />
			<content type="html"><![CDATA[<p>Я не знаю, может быть есть соответствующие встроенные команды, которые показывают список дисков. Вот первое лобовое решение:<br /></p><div class="codebox"><pre><code>
@echo off

set DISK_LIST=ABCDEFGHIJKLMNOPQRSTUVWXYZ

:disk.1

if not defined DISK_LIST goto disk.2
set D=%DISK_LIST:~0,1%

rem показать все имеющиеся диски в системе
cd %D%:\ 2&gt;nul &amp;&amp; echo.%D%

rem показать все имеющиеся диски за исключением SUBST&#039;d
rem cd %D%:\ 2&gt;nul &amp;&amp; ( subst | findstr &quot;%D%:\\&quot;&gt;nul || echo.%D% )

set DISK_LIST=%DISK_LIST:~1%
goto disk.1

:disk.2</code></pre></div><p>Как определить тип съемного накопителя из командной строки - было бы интересно узнать у коллег по форуму. Можно было бы решить с помощью JScript/VBScript.</p>]]></content>
			<author>
				<name><![CDATA[Rumata]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24846</uri>
			</author>
			<updated>2011-12-17T19:02:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=54725#p54725</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[CMD/BAT: Список дисков]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=54723#p54723" />
			<content type="html"><![CDATA[<p>Как создать список жестких дисков с выводом в файл? Файл результата должен содержать просто буквы, например:<br />C<br />D<br />E</p>]]></content>
			<author>
				<name><![CDATA[nouser]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27437</uri>
			</author>
			<updated>2011-12-17T17:55:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=54723#p54723</id>
		</entry>
</feed>
