Search code examples
c#vnc-viewer

Start VNC-VIewer with arguments


Hello im making a WindowsForms Application that opens the process VNC-Viewer.

this is my code i pass the ip i want to connect as argument and works.

ProcessStartInfo start = new ProcessStartInfo();
            start.Arguments = ipAddr;
            start.FileName = AppDomain.CurrentDomain.BaseDirectory + "VNC Viewer";
            start.WindowStyle = ProcessWindowStyle.Normal;
            start.CreateNoWindow = true;
            Process.Start(start);

However i want to know if i can also pass the password somehow so i can enter without putting the password(like putting the password as argument).

Thanks.


Solution

  • According to the documentation below, you can pass a configuration file as an argument to VNC Viewer, which can contain among others the host address and the password, so after you have the file ready you can do:

    start.Arguments = "-config FILE.vnc";
    

    https://www.realvnc.com/en/connect/docs/man/vncviewer.html#options