Running a .bat script in silent mode

Creating a macro - Writing a Script - Using the API

Running a .bat script in silent mode

Postby gkick » Thu Mar 11, 2021 3:15 am

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   Expand viewCollapse view
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
gkick
 
Posts: 292
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile

Re: Running a .bat script in silent mode

Postby Zizi64 » Thu Mar 11, 2021 8:01 am

Is the ECHO option switched ON in the batch file?
Tibor Kovacs, Hungary; LO6.1.6, 6.4.7 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.1.1;AOO4.1.9
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.
User avatar
Zizi64
Volunteer
 
Posts: 9842
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Running a .bat script in silent mode

Postby gkick » Thu Mar 11, 2021 8:22 am

Hi Zizi64, no echo is off
Libre Office 6.4.6 on Windows 10 HSQL 2.51 backend
gkick
 
Posts: 292
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile

Re: Running a .bat script in silent mode

Postby robleyd » Thu Mar 11, 2021 9:02 am

Have a look at https://stackoverflow.com/questions/235 ... ne-visible - maybe something there will help.
Cheers
David
Apache OpenOffice 420m2(Build:9821) - Slackware 14.2 - 64 bit
LibreOffice 6.4.6.2 (SlackBuild for 6.4.6 by Eric Hameleers) - Slackware 14.2 - 64 bit
Apache OpenOffice 4.1.4 - Windows 7 Virtual machine
User avatar
robleyd
Moderator
 
Posts: 3956
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Running a .bat script in silent mode

Postby gkick » Thu Mar 11, 2021 9:30 am

@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
gkick
 
Posts: 292
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile

Re: Running a .bat script in silent mode

Postby robleyd » Thu Mar 11, 2021 11:44 am

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
Apache OpenOffice 420m2(Build:9821) - Slackware 14.2 - 64 bit
LibreOffice 6.4.6.2 (SlackBuild for 6.4.6 by Eric Hameleers) - Slackware 14.2 - 64 bit
Apache OpenOffice 4.1.4 - Windows 7 Virtual machine
User avatar
robleyd
Moderator
 
Posts: 3956
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 3 guests