https://bugs.documentfoundation.org/show_bug.cgi?id=96038

            Bug ID: 96038
           Summary: Shell function does not work whith .bat files and
                    paths containing spaces
           Product: LibreOffice
           Version: 5.0.3.2 release
          Hardware: All
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: [email protected]
          Reporter: [email protected]

On Windows, in basic macros, the shell() function does not work when executing
a .bat file and when the path contains spaces. The usual ConvertToURL() trick
does not work when executing .bat files.

To reproduce the bug:

1. Create a directory C:\Temp\Temp Folder

2. Create a test.bat file with the following content:

echo Test
pause

and copy that file to C:\Temp and C:\Temp\Temp Folder

3. Copy C:\Windows\write.exe to C:\Temp and C:\Temp Folder to get an .exe test
case

4. Create the following basic macro:

Sub Test

' Works
'Shell(ConvertToURL("C:\Temp\test.bat"), 1)

'Works
'Shell(ConvertToURL("C:\Temp\write.exe"), 1)

' Works
'Shell(ConvertToURL("C:\Temp\Test Folder\write.exe"), 1)

' Does not work
Shell(ConvertToURL("C:\Temp\Test Folder\test.bat"), 1)

' Works
'Shell("cmd.exe", 1, "/c " & "C:\Temp\write.exe")

' Does not work
'Shell("cmd.exe /c", 1, "C:\Temp\test.bat")

' Works
'Shell("cmd.exe /c", 1, """C:\Temp\Test Folder\write.exe""")

' Does not work
'Shell("cmd.exe /c", 1, """C:\Temp\Test Folder\test.bat""")

End Sub

5. Execute the macro and check that it's only possible to execute test.bat when
the path does not contain space. On the contrary, executing write.exe is
possible whatever the path contains spaces or not.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to