Running a .bat script in silent mode

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
gkick
Posts: 324
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile

Running a .bat script in silent mode

Post by gkick »

Hi,

Shell does not recognise a batchfile unless its compiled bat2exe or embedded within a cmd command.
I got the following working, but it throws up the console window.

Code: Select all

Sub modp
Dim objExec As Object
objExec = createUnoService("com.sun.star.system.SystemShellExecute")
objExec.execute("C:Windows\system32\cmd.exe", "/d /c ""C:\LDS\sMplan\lib\setm.bat""", 0)
End Sub
Any one knows how to possible run this in a silent way, thks
Libre Office 6.4.6 on Windows 10 HSQL 2.51 backend
User avatar
Zizi64
Volunteer
Posts: 11353
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Running a .bat script in silent mode

Post by Zizi64 »

Is the ECHO option switched ON in the batch file?
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
gkick
Posts: 324
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile

Re: Running a .bat script in silent mode

Post by gkick »

Hi Zizi64, no echo is off
Libre Office 6.4.6 on Windows 10 HSQL 2.51 backend
User avatar
robleyd
Moderator
Posts: 5056
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Running a .bat script in silent mode

Post by robleyd »

Have a look at https://stackoverflow.com/questions/235 ... ne-visible - maybe something there will help.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.1.2; SlackBuild for 24.2.1 by Eric Hameleers
gkick
Posts: 324
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile

Re: Running a .bat script in silent mode

Post by gkick »

@robleyd Thanks for the link, trouble is LO does not like running vbs scripts either from shell. Tell me where is Murbko ?
Libre Office 6.4.6 on Windows 10 HSQL 2.51 backend
User avatar
robleyd
Moderator
Posts: 5056
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Running a .bat script in silent mode

Post by robleyd »

I was wondering if the start would be helpful, or using a link to invoke the batch file.
gkick wrote:Tell me where is Murbko ?
In the middle of nowhere :D
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.1.2; SlackBuild for 24.2.1 by Eric Hameleers
Post Reply