1

I have to run a console program to transfer files from a local network drive to an off-site account. I'm at a standstill for automating this because the console program doesn't provide a password parameter.

Here is a general overview of the command line for the console program and its prompt for the password:

C:\> UploadTool [flags] Drive:\Accounts\AccountNumber\FilesFolder\
     UserName@host /RemoteDirectory/Folder
.
.
.
Password:
.
.
.

If the connection is successful, I’m prompted for a password in the command window (DOS), and then the upload starts.

I need some direction for what I could do in .NET to automate this workflow for multiple accounts. Does .NET include any libraries for interacting with the MS DOS screen? I need a way to run the console program and insert the password when prompted.

DavidRR
  • 18,291
  • 25
  • 109
  • 191
user3541092
  • 267
  • 1
  • 3
  • 12

1 Answers1

2

Use Process to start the console application. Then use Process.StandardOutput to read the output of the application and Process.StandardInput to send it input (the password).

http://msdn.microsoft.com/en-us/library/system.diagnostics.process(v=vs.110).aspx

Samuel Neff
  • 73,278
  • 17
  • 138
  • 182