use pscp with DSA key without password under Windows

Jephe Wu -

Objective: use pscp and pageant for ssh DSA authentication without password
Environment: Windows

 1. use pageant to generate jephe and jephe.ppk on Windows , then put the content of jephe to the openssh server jephe homedirectory .ssh/authorized_keys2.

2. script
@For /F "tokens=1,2,3 delims=/ " %%A in ('Date /t') do @(
    Set Month=%%A
    Set Day=%%B
    Set Year=%%C
note: above script "tokens=1,2,3 delims=/ ", means delimiter is / or white space. %%A means %A, which is for the whole string of command 'date /t', then use / or white space as delimiter

@For /F "tokens=1,2 delims= " %%A in ('Time /t') do @(
    Set Hour=%%A
    Set Second=%%B

note: use only whitespace as delimiter.

set yearmonthday=%Year%%Month%%Day%
set hoursecond=%Hour% %Second%

echo --- >> log.txt
echo pscp  -i jephe.ppk jephe@ jephe.txt.%yearmonthday% %hoursecond%  >> log.txt
pscp  -i jephe.ppk jephe@ .  >> log.txt 2>&1