reg query

  • Thread starter Thread starter zwang
  • Start date Start date
Z

zwang

Is there a way to obtain a user's default printer? from
windows DOS command? Then a batch file can be created to
print anything like:

set PRINTER=<some command>
Copy /b %1 %PRINTER%

Thanks.
 
Is there a way to obtain a user's default printer? from
windows DOS command? Then a batch file can be created to
print anything like:

set PRINTER=<some command>
Copy /b %1 %PRINTER%

Thanks.

See tip 672 in the 'Tips & Tricks' at http://www.jsiinc.com

Using reg from the W2K Support Tools:
set key="HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows"
for /f "Skip=4 Tokens=2*" %%p in ('REG QUERY %key% /v Device') do set prtn=%%q

Then extract the server name:

set prtn=%prtn:)=}%
for /f "Tokens=1 Delims=\" %%p in ('@echo %prtn%') do set server=%%p

Then using rmtshare from tip 6353, use a for command to parse
rmtshare \\%server%



Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
See tips 7280 and 7281 in the 'Tips & Tricks' at http://www.jsiinc.com

Is there a way to obtain a user's default printer? from
windows DOS command? Then a batch file can be created to
print anything like:

set PRINTER=<some command>
Copy /b %1 %PRINTER%

Thanks.

See tip 672 in the 'Tips & Tricks' at http://www.jsiinc.com

Using reg from the W2K Support Tools:
set key="HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows"
for /f "Skip=4 Tokens=2*" %%p in ('REG QUERY %key% /v Device') do set prtn=%%q

Then extract the server name:

set prtn=%prtn:)=}%
for /f "Tokens=1 Delims=\" %%p in ('@echo %prtn%') do set server=%%p

Then using rmtshare from tip 6353, use a for command to parse
rmtshare \\%server%



Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Back
Top