building a batch file that is essentially:
Not a fan of this method.
Or storing an MD5 Hash and passing that through a la: http://kb.perforce.com/UserTasks/ConfiguringP4/AvoidingTheP..rdInWindows.
A google search came up empty. This surprised me as I would have thought something like this would have been a common need. Who knew?
So, I figured that I'd just write my own. I mean, how hard can it be? All you have to do is pass in the password on the command line, right?
The other thing is that I want whatever app I create to be nearly stand-alone. The only thing that it should rely on is P4.exe. I don't want it to hook into the P4 API, or any other nonsense (being dependent on P4.exe is bad enough).
Wrong. P4 login doesn't work that way. You can't pass in the password, it has to come through Standard Input. Whut-oh.
Well, it's not that bad, actually. Using CSharp, it's just a matter of using the Process object and hooking into the StdInput. Surprisingly easy, once you find it.
The form is a simple layout. I don't even ask for a username (easy enough for you, dear reader, to add). But for my case, all I need is the password. So a quick mock-up of the GUI would look like this:
|The Window Mockup|
So, what's the code that does all this funky stuff?
Again, the big thing here is to use a streamwriter object as the redirection for STDIN. At that point, it a stream and you can do pretty much anything you want to.
Additionally, I've archived the project. You can access it here