<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; VBScript: как найти принтер в системе по умолчанию]]></title>
		<link>http://forum.script-coding.com/viewtopic.php?id=134</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=134&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «VBScript: как найти принтер в системе по умолчанию».]]></description>
		<lastBuildDate>Tue, 05 Sep 2006 09:56:44 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[VBScript: как найти принтер в системе по умолчанию]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=579#p579</link>
			<description><![CDATA[<p>Это можно сделать через WMI:</p><div class="codebox"><pre><code>On Error Resume Next
Set objService = GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!\\.\root\CIMV2&quot;)
If Err.Number &lt;&gt; 0 Then
    WScript.Echo Err.Number &amp; &quot;: &quot; &amp; Err.Description
    WScript.Quit
End If
For Each objPrn In objService.ExecQuery(&quot;SELECT * FROM Win32_Printer&quot;)
    If objPrn.Attributes And 4 Then
        WScript.Echo objPrn.Name
        Exit For
    End If
Next</code></pre></div><p>Кроме того, можно просто прочитать соответствующее значение реестра:</p><div class="codebox"><pre><code>Set objShell = CreateObject(&quot;WScript.Shell&quot;)
Prn = objShell.RegRead(&quot;HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device&quot;)
WScript.Echo Prn</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (The gray Cardinal)]]></author>
			<pubDate>Tue, 05 Sep 2006 09:56:44 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=579#p579</guid>
		</item>
	</channel>
</rss>
