Using CD command when there is a space. ERROR "Too many parameters for command 'cd'."

Advertisement

vmedhe
Joined:
Posts:
2
Location:
Chicago

Using CD command when there is a space. ERROR "Too many parameters for command 'cd'."

Hey all this seems to be a pretty simple one but there seems to be nothing on here about how to fix it save one post with no examples.

I am using WinSCP and a generated URL in PowerShell to fire this off. But when I try to change directories I get the error:
Too many parameters for command 'cd'.
This is where I want to go:
"cd /Covid Reports"`
The space is of course the issue and everyone keeps telling me to double quote it. But that does not seem to work. Obliviously im doing it wrong but have no clue HOW im doing it wrong, any advice or if someone could put the fix and explain the double quotes everyone is talking about that would be nice.

Reply with quote

Advertisement

vmedhe
Joined:
Posts:
2
Location:
Chicago

Hey Martin,
I actually tried that but it did not work. Instead I still get the error below. I will post the full code now to see if it maybe shows the issue usernames, keys, passwords, are scrubbed. It seems to file trying to find the Covid report file and still thinks its only named /Covid.

Searching for host...
Connecting to host...
Authenticating...
Using username "user".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Session started.
Active session: [1] activesession@ftp.fake.com
Error changing directory to '/Covid'.
Cannot get real path for '/Covid'.
The file path does not exist or is invalid.
Error code: 10
Error message from server (en-US): Unable to resolve path
/
cd /Outgoing/Immunization
lcd ""\\aicps01\home\PSfiles\Medicat""
exit
Error
& "C:\Program Files (x86)\WinSCP\WinSCP.com" `
  /log="\\aicfs01\SAIC\users\vmedhe\thing.log" /ini=nul `
  /command `
    "open sftp -hostkey=`"`"hostkey=`"`"" `
   "cd ""/Covid Reports"""`
   "lcd `"`"\\aicps01\home\PSfiles\COVID`"`"" `
        "get -filemask=`"`">today`"`" *.*" `
   "cd /Outgoing/Immunization" `
   "get -filemask=`"`">today`"`" SAIC_Notcompliant_*.txt" `
   "lcd `"`"\\aicps01\home\PSfiles\Medicat`"`"" `
        "get -filemask=`"`">today`"`" *.*" `
    "exit"
 
$winscpResult = $LastExitCode
if ($winscpResult -eq 0)
{
  Write-Host "Success"
}
else
{
  Write-Host "Error"
}
 
exit $winscpResult

Reply with quote

Advertisement

You can post new topics in this forum