<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VBScript: как найти принтер в системе по умолчанию]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=134&amp;type=atom" />
	<updated>2006-09-05T09:56:44Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=134</id>
		<entry>
			<title type="html"><![CDATA[VBScript: как найти принтер в системе по умолчанию]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=579#p579" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[The gray Cardinal]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=2</uri>
			</author>
			<updated>2006-09-05T09:56:44Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=579#p579</id>
		</entry>
</feed>
