How can I rewrite this code and stores it in a variable

Advertisement

flowdrw
Joined:
Posts:
2
Location:
Philippines

How can I rewrite this code and stores it in a variable

& "C:\Program Files (x86)\WinSCP\WinSCP.com" `
  /log="C:\writable\path\to\log\WinSCP.log" /ini=nul `
  /command `
 "open sftp://192.168.1.1/ 
   -hostkey=
   -privatekey=
    "lcd `"`"C:\Program Files\Microsoft SQL Server\Backup`"`"" `
    "cd /owncloud/backup" `
    "put latest file 1" `
    "put latest file 2" `
    "exit"
 
$winscpResult = $LastExitCode
if ($winscpResult -eq 0)
{
  Write-Host "Success"
}
else
{
  Write-Host "Error"
}
 
exit $winscpResult

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: How can I rewrite this code and stores it in a variable

How do you want to rewrite it? What for? What do you want to store?

Reply with quote

Advertisement

You can post new topics in this forum