LUA script to run CMD

You can share your Lua Scripts with everybody here.

LUA script to run CMD

Postby tmays » Fri Jan 25, 2013 4:18 pm

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
tmays
 
posts 4
 
joined Fri Jun 15, 2012 3:59 pm

Re: LUA script to run CMD

Postby FTP » Fri Jan 25, 2013 6:08 pm

Yes, you can execute an external program like this: os.execute("c:/test.bat")
FTP
Site Admin
 
posts 1226
 
joined Tue Sep 29, 2009 6:09 am

Re: LUA script to run CMD

Postby tmays » Mon Jan 28, 2013 5:08 pm

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?
tmays
 
posts 4
 
joined Fri Jun 15, 2012 3:59 pm

Re: LUA script to run CMD

Postby FTP » Thu Jan 31, 2013 2:16 pm

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.
FTP
Site Admin
 
posts 1226
 
joined Tue Sep 29, 2009 6:09 am


Return to Lua scripts

Who is online

Users browsing this forum: No registered users and 2 guests

cron