Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

free_hat

Re: Run WinSCP Script From Bat File AS DIFFERENT USER

Many thanks.
free_hat

Run WinSCP script From bat file as different user

Hi, could anybody help me with this please:

I can successfully call a WinSCP script from a bat file like this:
"C:\Program Files (x86)\WinSCP\WinSCP.com" /script="script_file_path.txt"

I can also successfully open a program such as notepad as a different user like this:
runas /user:my_user@my_domain "C:\Windows\notepad.exe"

However I cannot call a WinSCP script as a different user by doing this:
runas /user:my_user@my_domain "C:\Program Files (x86)\WinSCP\WinSCP.com" /script="script_file_path.txt"

When I run the code, it does nothing. It doesn't prompt for a password, open WinSCP or run the script. If I add a pause at the end to see what is on the cmd screen it is a list of prompts and their descriptions for the runas command.

Many thanks in advance.

James