Using system.util.execute on gateway to run command line applications

I’m trying to execute xcopy.exe on a gateway event script using the following code:

cmd = [‘c:/windows/syswow64/xcopy.exe’, ‘\\l2-video-1\images’, ‘e:\images\’, ‘/S’, ‘/D’, ‘/C’, ‘/Y’]
system.util.execute(cmd)

The code executes fine using the console but doesn’t work at all when executed from within a gateway event (tag change) script. I’ve put additional code in to trap the procedure so I know that it is executing on the gateway. I’ve also turned UAC off. Any other ideas?

Thanks

The difference might be the user running the script. When you run the script out of the console, the Windows user is you, so everything works. But when the script runs under the gateway, it runs as the Windows service user.

1 Like

Thanks mgross. I think you’re right. I’ve pursued doing the same operation using the java.io and shutil libraries.