Nifi run batch file. CMD (.bat). ExecuteProcess

I have tried several configurations to run batch script (cmd) in Windows following a schedule using nifi. I think this configuration should work using ExecuteProcess processor. But it does not.

My "ExecuteProcess" configuration is:

My .bat script is:

"C:\Program Files (x86)\WinSCP\winscp.com" /ini=nul /command ^
    "open sftp://exchange:[email protected]/ -hostkey=""ecdsa-sha2-nistp384 384 T8cTR+P5Ubm9NrbrcopI2mSz2QUOzYRvQrS1w+rSoyM=""" ^
    "synchronize local -delete \\SFS.CORP\Apps\ICT\ZILOC\intercambiosSFTP\SPC /" ^
    "exit"

If I run ".bat" file outside nifi it works fine.

Could someone help me? I have googled without results.

Would it be possible to include url and folder paths as variables/parameters?

Thanks in advance.

Upvotes: 0

Views: 1520

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202504

You are missing /C switch for cmd.

This does not work:

cmd C:\Users\SA-2J04-SAFES\Desktop\sync.bat

You need to use

cmd /C C:\Users\SA-2J04-SAFES\Desktop\sync.bat

So you need to prepend the /C before your "Command arguments".

Upvotes: 1

Related Questions