Page 1 of 1

LUA script to run CMD

Posted: Fri Jan 25, 2013 4:18 pm
by tmays
I am wanting to see if I can use the onfileupload event to trigger a test.cmd or test.bat file

I don't want to use the execute program part, I want to be able to add to the LUA script as I need to.

For example. I want it to run when a file is uploaded in folder1 run test.cmd

Re: LUA script to run CMD

Posted: Fri Jan 25, 2013 6:08 pm
by FTP
Yes, you can execute an external program like this: os.execute("c:/test.bat")

Re: LUA script to run CMD

Posted: Mon Jan 28, 2013 5:08 pm
by tmays
Ok I can get the cmd process to start but does nothing that I can see. I have a .bat file that runs a simple code that runs PSexec to run a script on a remote server.

C:\Windows\System32\PsExec.exe \\10.0.1.77 -d -u domain\User -p Password "C:\test2.bat"


I tried os.execute ("c/test.bat")

and it only starts PSexec but does not run anything further?

Any thoughts? or other options to get this to work?

maybe start cmd and pass the commands I want it to run?

Re: LUA script to run CMD

Posted: Thu Jan 31, 2013 2:16 pm
by FTP
Yes, because Wing FTP Server is running as Windows service by the default, it can run program, but it can't show the GUI of that program, you can disable the "Wing FTP Server" service first, and then start Wing FTP Server by double-clicking like other applications.