Batch Files

when i run the following batch from from its location it works, bu twhen i run it from a ssis package in a execute process task i get the following error.
CD C:\Program Files\WinSCP\  /command "option batch abort" "option confirm off" "open to:dan@" "cd /for" "put ""\\s-001\Data\data\Extracts\ArchivePath\ArchiveFiles\aaa.csv""" "EXIT"

Extract.bat" "" at "", The process exit code was "1" while the expected was "0".

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kamaraj SubramanianApplication Support AnalystCommented:
in your .bat file put this single line only

C:\Program Files\WinSCP\  /command "option batch abort" "option confirm off" "open to:dan@" "cd /for" "put ""\\s-001\Data\data\Extracts\ArchivePath\ArchiveFiles\aaa.csv""" "EXIT"  

Open in new window

aneilgAuthor Commented:
thanks but just tries that and it does not work.
Kamaraj SubramanianApplication Support AnalystCommented:
can you put echo in front and give the output

echo C:\Program Files\WinSCP\  /command "option batch abort" "option confirm off" "open to:dan@" "cd /for" "put ""\\s-001\Data\data\Extracts\ArchivePath\ArchiveFiles\aaa.csv""" "EXIT"

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Steve KnightIT ConsultancyCommented:
Is line #7 your output.... the arrangement of quotes is a bit odd!

Have you thought about just running the exe from your process rather than a batch file?

Also has whatever this is being run as got access to the share \\s-001\Data and the folder beneath it.

You could create a batch as follows to see some more info:

@echo off
echo Current dir: %cd%
echo Batch filename: %~f0
pushd "\\s-001\Data"
dir "data\Extracts\ArchivePath\ArchiveFiles\aaa.csv"
"C:\Program Files\WinSCP\"  /command "option batch abort" "option confirm off" "open to:dan@" "cd /for" "put ""data\Extracts\ArchivePath\ArchiveFiles\aaa.csv""" "EXIT"
) > "%temp%\logfile.txt" 2>&1

And that will write those details to a log file in temp drive.
aneilgAuthor Commented:
i think its something to do with the exit and using the "" or ,
Steve KnightIT ConsultancyCommented:
So what does the test file above do?
Is the failure occurring on an x64 box?  Perhaps you need c:\program files (x86)?
aneilgAuthor Commented:
not fully resolved
Steve KnightIT ConsultancyCommented:
As with your other question closed in the same way.... rather than offering a "B" grade and no feedback perhaps you could either give us feedback so we can work more on it, or enlighten us and others reading this in the future with what DID fix it.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.