LUA script to run CMD

You can share your Lua Scripts with everybody here.
Post Reply
tmays
Posts: 4
Joined: Fri Jun 15, 2012 3:59 pm

LUA script to run CMD

Post 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
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: LUA script to run CMD

Post by FTP »

Yes, you can execute an external program like this: os.execute("c:/test.bat")
tmays
Posts: 4
Joined: Fri Jun 15, 2012 3:59 pm

Re: LUA script to run CMD

Post 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?
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: LUA script to run CMD

Post 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.
Post Reply