Calling a WinSCP job from a remote PC
I am trying to run a batch script from another PC. This batch script contains a WinSCP process. The rest of the batch script works fine, but I keep getting errors with the WinSCP portion of the program. I am a newbie, so the solution may be a very simple one. I am using "PS EXEC" to run the script from the local PC. The script on the remote PC is as follows:
__________________________________
cd c:\"Program Files"
cd Winscp
:getfile
winscp.exe /console /script=c:\RECON\getRECON.txt
if exist C:\RECON\Files\RECON* goto email
goto end
:email
Powershell.exe -executionpolicy remotesigned -File C:\RECON\emailRECONfiles.ps1
move /Y C:\RECON\Files\*.* C:\RECON\Archive
:end
exit
__________________________________
The WinSCP script is as follows:
__________________________________
#Open Connection
open [Saved Session]
# Change local directory
lcd C:\RECON\Files
cd RECON
# Force binary mode transfer
option transfer binary
# Download the file to current working directory then delete on SFTP folder
mget RECON*
rm RECON*
# Disconnect
close
# Exit WinSCP
exit
___________________________
The PowerShell script that emails works and everything else in the script works. I just keep getting emails with no attachments.
Thanks,
Update:
Never mind. I moved the WinSCP.ini file into the same directory that the WinSCP.exe was in and it worked perfectly.
__________________________________
cd c:\"Program Files"
cd Winscp
:getfile
winscp.exe /console /script=c:\RECON\getRECON.txt
if exist C:\RECON\Files\RECON* goto email
goto end
Powershell.exe -executionpolicy remotesigned -File C:\RECON\emailRECONfiles.ps1
move /Y C:\RECON\Files\*.* C:\RECON\Archive
:end
exit
__________________________________
The WinSCP script is as follows:
__________________________________
#Open Connection
open [Saved Session]
# Change local directory
lcd C:\RECON\Files
cd RECON
# Force binary mode transfer
option transfer binary
# Download the file to current working directory then delete on SFTP folder
mget RECON*
rm RECON*
# Disconnect
close
# Exit WinSCP
exit
___________________________
The PowerShell script that emails works and everything else in the script works. I just keep getting emails with no attachments.
Thanks,
Update:
Never mind. I moved the WinSCP.ini file into the same directory that the WinSCP.exe was in and it worked perfectly.