Problems Running Script

Advertisement

jchornsey
Joined:
Posts:
4
Location:
Colorado, USA

Problems Running Script

I'm trying to execute WinSCP with a script from within PowerShell. I've created the PS script so that it creates the WinSCP script file programmatically based on yesterday's date.

The script file is created successfully and when I execute those steps from within "winscp.exe /console" or "winscp.com", each of the steps work perfectly.

However, when I try to execute from a command line with the "/script" switch, either nothing appears to happen, or I get an error.

Nothing is generated with the "/log" switch.

c:\Program Files (x86)\WinSCP>winscp.exe /console /script="I:\scripts\2016-01-21.txt" /log="I:\log.txt"

c:\Program Files (x86)\WinSCP>winscp.com /console /script="I:\scripts\2016-01-21.txt" /log="I:\log.txt"
No mapping for the Unicode character exists in the target multi-byte code page

c:\Program Files (x86)\WinSCP>winscp.com /script="I:\scripts\2016-01-21.txt" /log="I:\log.txt"
No mapping for the Unicode character exists in the target multi-byte code page

c:\Program Files (x86)\WinSCP>winscp /script="I:\scripts\2016-01-21.txt" /log="I:\log.txt"
No mapping for the Unicode character exists in the target multi-byte code page

c:\Program Files (x86)\WinSCP>winscp.exe /script="I:\scripts\2016-01-21.txt" /log="I:\log.txt"

c:\Program Files (x86)\WinSCP>winscp /script=I:\scripts\2016-01-21.txt /log=I:\log.txt
No mapping for the Unicode character exists in the target multi-byte code page    

Any ideas?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: Problems Running Script

What happens when you run the same commands in Windows command-line (cmd.exe)?

Reply with quote

jchornsey
Joined:
Posts:
4
Location:
Colorado, USA

The "code" section is from the command prompt.

If I run the script command from within 'winscp.exe /console' or 'winscp.com', each of the commands in the script run fine.

When I try to execute with the '/script' switch, nothing happens. Or, I get the unicode mapping error.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

I've never seen that "Unicode" error before.

What happens when you use winscp.exe /console /script=...? Does console window popup?

Reply with quote

jchornsey
Joined:
Posts:
4
Location:
Colorado, USA

martin wrote:

What happens when you use winscp.exe /console /script=...? Does console window popup?

It does, but it disappears so quickly, I can't see if it actually did anything.

And, with the /log switch, nothing is logged.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Are you sure you have a write access to that I: drive? Could you try to log to a local drive instead (like %TEMP%)?

What happens when you use winscp.com from Start > Run instead of a cmd.exe console/command-line?

What happens when you use winscp.com from console/command-line and redirect its output to a local file?

Reply with quote

jchornsey
Joined:
Posts:
4
Location:
Colorado, USA

Thanks for your comments and suggestions. Unfortunately, I wasn't able to get past the error. So, I just wrote the script to use the built-in Microsoft FTP client.

Thanks, though!

Reply with quote

kkas
Guest

Problems Running Script

I'm experiencing same behaviour.
It worked once, after making one line change in script -txt file, got code page mapping error.
put -nopermissions -filemask="*>=1D" *
Used ver 5.7.6. and 5.8.1b
Works ok with winscp.exe /console /script=

C:\Temp>winscp.com /script=C:\temp\upload_script.txt /log=C:\temp\winscp.log /loglevel=0
No mapping for the Unicode character exists in the target multi-byte code page

C:\Temp>"C:\Program Files (x86)\WinSCP\start_script.bat"

C:\Temp>winscp.com /script="C:\Program Files (x86)\WinSCP\upload_script.txt" /log="C:\Program Files (x86)\WinSCP\winscp.log" /loglevel=0
No mapping for the Unicode character exists in the target multi-byte code page

BR,

Kimmo

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: Problems Running Script

Can you attach the script file?

Reply with quote

Cassu
Guest

Script

Here you go, had to remove actual address and key.
All commands are working perfectly with CLI. Starting this with .bat and task scheduler bugs..

open scp://xxxx@1.2.3.4 / -hostkey="ssh-rsa 2048 key" -privatekey="C:\Program Files (x86)\WinSCP\hostname_private_ssh_key_wo_pass" -rawsettings AgentFwd=1
# Change local directory
lcd z:\
# Force ascii mode transfer
option transfer ascii
# command
pwd
# command
ls
# put 24h modifioidut -nopermissions
put -nopermissions -filemask="*>=1D" *
pwd
ls
exit

BR,

Kimmo

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: Script

The script looks good. Though I really mean, if you can attach it as a file?

What was the one line change you did?

Reply with quote

MarcoFR73
Guest

I found the solution

Hi all.

I had same problem.
The file script was wrote under Windows, but the server witch I was wanting to access is an Unix server.
Finally, I rewrote the script under Unix, with vi.

And that's fine.



ps : sorry for my bad english...

Reply with quote

Advertisement

You can post new topics in this forum