Jump to content
Sign in to follow this  

Registry Variables

Recommended Posts


Hello All,

I was wondering if it was at all possible to make a location within the registry a variable;

$var1 = PRINTER1


$port = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\$var1", "Port")

If anyone could give me some direction it would be great!


Share this post

Link to post
Share on other sites

I have managed to find a workaround which seems to be working;

Thanks all!

$printername = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device")

$printername = StringTrimRight($printername, 15)

$RegKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\" & $printername & "\"

$RegKey2 = RegRead($regkey,"Port")

MsgBox(0, "Your Printer Port is ", $Regkey2)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this