Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

We have a functionality where in we are transferring the .csv files to remote SFTP server using batch (.bat file on windows) file. Batch file uses WinSCP and passes username and password (in clear text). We have scheduled this file using windows scheduler and it works fine. Till here there is no issue.

But we have a requirement to either hide or encrypt the password that we are passing in clear text. For this we tried with Alternate Data Stream concept where we are storing the password in ADS and then retrieving this password using another batch file in main batch file which transfers the file to remote SFTP. If we are manually calling the batch file the password to main batch file is provided and file transfer is successful to remote SFTP. Till here we have achieved hiding of password and file transfer.

But while scheduling the main batch file through windows scheduler, the password doesn't get retrieved in main batch file and file transfer fails. Please let us know if there is any way to achieve this.

ADS

What I have tried:

Posted
Updated 29-Mar-19 1:52am
Comments
SNI 29-Mar-19 6:50am    
forgot to provide ADS url
http://scripts.dragon-it.co.uk/scripts.nsf/MainFrame?OpenFrameSet&Frame=East&Src=%2Fscripts.nsf%2Fdocs%2Fbatch-password1!OpenDocument%26AutoFramed
Richard MacCutchan 29-Mar-19 7:21am    
Why not ask the people at Dragon?

1 solution

Create an executable with the encrypted password stored in a variable. Have the executable run sftp instead of using the batch file.

If you need to change the filename every once in a while, that can be accomplished via an app.config file, or you can simply put the file to be transferred in a location known by the application, which can then use the FileSystemWatcher object to determine when a new/changed file is in the folder.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900