I have multiple databases that I connect to using SQL*Plus in Windows (not the command window).
I've been looking for a way to change the title of the window, so that I can distinguish one instance from another, from the task bar. Yes, I know I can change the prompt, but then I have to switch between the instances and read the prompt, until I get to the right one.
Is this even possible? And if so how?
for sqlplus.exe, as you know, you can use glogin.sql (in the sqlplus directory of your Oracle client) to run sqlplus commands at the start of your session.
you could also try the HOST command from within sqlplus to execute commands on your shell:
HOST title [my db name]
you can try to put this call into the glogin.sql (as well as your custom prompt).
edit:
for sqlplusw, i have seen here a 'solution' that suggests creating shortcuts for each server you wish to connect to, and windows will take the title of the short cut for the title of the window.
[DllImport("user32.dll", SetLastError =true, CharSet =CharSet.Auto)]
static extern IntPtr SetWindowText(IntPtr hwnd, String lpString);
Process process = new Process();
process.StartInfo.FileName = "sqlplusw";
process.Start();
process.WaitForInputIdle();
SetWindowText(process.MainWindowHandle, "PRODUCTION - BE CAREFUL!!");
I was able to cobble together a wrapper that does what I wanted. Now to make it more general purpose....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With