How to launch .bat / WIN 10 directly from Servoy ?

Questions, tips and tricks and techniques for scripting in Servoy

How to launch .bat / WIN 10 directly from Servoy ?

Postby rainer » Wed May 15, 2019 12:47 pm

I need to execute a .bat file on WIN10 from servoy.

It seems that it fails due do the win10 rights management ( Java Error #740 ).
Tried converting into .exe (admin) or shortcut - but it fails.
Starting the .bat directly from the desktop works.

How can i solve the problem ? Think i need to execute the .bat as admin directly from servoy ?!

Thank you for your help

Rainer
Last edited by rainer on Thu May 16, 2019 11:27 pm, edited 1 time in total.
rainer
 
Posts: 11
Joined: Fri Aug 17, 2012 9:58 am

Re: How to launch .bat / WIN 10 from directly from Servoy ?

Postby Joas » Wed May 15, 2019 1:29 pm

What does your code look like?
It should be something like:
Code: Select all
application.executeProgram("C:/your.bat");

To run a .bat-file with admin rights means that your Servoy process needs to have admin rights, which is probably not a good idea security-wise.

So what are you doing in your .bat file that needs admin rights anyway? Is there no way around that?
Joas de Haan
Yield Software Development: Need help on your project?
yieldsd.com
User avatar
Joas
Site Admin
 
Posts: 839
Joined: Mon Mar 20, 2006 4:07 pm
Location: Leusden, NL

Re: How to launch .bat / WIN 10 from directly from Servoy ?

Postby rainer » Thu May 16, 2019 11:27 pm

Solved.

For .bat files only "plugins.file.openFile" worked...
rainer
 
Posts: 11
Joined: Fri Aug 17, 2012 9:58 am

Re: How to launch .bat / WIN 10 directly from Servoy ?

Postby Andrei Costescu » Mon Jun 03, 2019 9:22 am

Yes I think application.executeProgram is a bit more low level (and batch files cannot be interpreted directly by that) while plugins.file.openFile is more the equivalent of a "start" command in case of Windows.
So - I didn't try it - but something like this might work (give it something to interpret the .bat file with): application.executeProgram("cmd", ["/c", "your.bat"])
Andrei Costescu
Servoy
Andrei Costescu
 
Posts: 1016
Joined: Tue Jun 26, 2007 3:14 pm


Return to Methods

Who is online

Users browsing this forum: No registered users and 5 guests