Topic "Problems Running Script"

Author Message
jchornsey
[View user's profile]

Joined: 2016-01-22
Posts: 4
Location: Colorado, USA
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.

Code:

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?
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24995
Location: Prague, Czechia
What happens when you run the same commands in Windows command-line (cmd.exe)?
jchornsey
[View user's profile]

Joined: 2016-01-22
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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24995
Location: Prague, Czechia
I've never seen that "Unicode" error before.

What happens when you use winscp.exe /console /script=...? Does console window popup?
jchornsey
[View user's profile]

Joined: 2016-01-22
Posts: 4
Location: Colorado, USA
prikryl 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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24995
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?
jchornsey
[View user's profile]

Joined: 2016-01-22
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!
kkas

Guest


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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24995
Location: Prague, Czechia
Can you attach the script file?
Cassu

Guest


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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24995
Location: Prague, Czechia
The script looks good. Though I really mean, if you can attach it as a file?

What was the one line change you did?
MarcoFR73

Guest


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...
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License