Apache OpenOffice (AOO) Bugzilla – Issue 18496
StarBasic command "shell" problem
Last modified: 2017-05-20 11:29:22 UTC
I have to execute an external programm with some parameters: > hallo.exe -c "xyz abc?status=test&ort=platte c" The command processor gets this as two parameters an anything is ok. In StarBasic I write: shell ("c:\hallo.exe", 0 , "-c ""xyz abc?status=test&ort=platte c""") It does not work. The parameters are splitted. What I have tried: - Use single quotes - Use escape characters of the Windows 2000 command processor - Use XSystemShellExecute.execute It seems, that someone parses the parameter string and drops some elements. If there is a valid combination, it would be nice to find it in the documentation.
Some additional informations: shell ("c:\hallo.exe", 0 , "-c 'xyz abc?status=test&ort=platte c'") -> works shell ("c:\hallo.exe", 0 , "-c 'xyzabc?status=test&ort=plattec'") -> works not shell ("c:\hallo.exe", 0 , "-c ' xyzabc?status=test&ort=plattec'") -> works So the generic workaround is, if an own application is called: - use single quotes - add a space in front of the parameter - trim the parameter in the application
StarBasic runtime issue -> UDK.
-> OOo 2.0
cp: retargeted to Office-Later due to limited ressources
*** Issue 35568 has been marked as a duplicate of this issue. ***
============================================================== Comments from i35568: create a simple batch at 'c:\abc def' with: echo %1 %2 > c:\bug.txt call it with print shell("'c:\abc def\bug.sh'", 1, "dumy", true) -> result is 0 which indicates it was run successfull but the file c:\bug.txt doesn't exist in so7 this worked correct and the file bug.txt was created remove the space between c and d and run again -> result is still 0 in so7 an error was thrown, telling that the command wasn't found ------- Additional comments from ab Fri Oct 15 01:01:13 -0700 2004 ------- AB->TBO: Sorry, but I connot reproduce this at all. I couldn't make your example print shell("'c:\abc def\bug.bat'", 1, "dumy", true) work anywhere. Both SO 8 / src680 m54 (no Basic changes have been done in m55/m56) and a SO7 PP0 always throw an error. I used bug.bat in Windows, because bug.sh did not work at all, also not in VB. Also VB6 (changing print to msgbox and leaving away the incompatible last two parameters) is not able to execute: MsgBox Shell("'C:\abc def\bug.bat' dummy") even if C:\abc def\bug.bat exist. But, assuming that "C:\abcdef\bug.bat" exist, MsgBox Shell("C:\abcdef\bug.bat dummy") is executed in the same way by SO 7, SO 8 and VB. Besides that the Shell command implementation hasn't been changed since SO 7. So if you still see a problem, please ask first if anything has changed in the vos OProcess class used by Basic to execute a shell command. But I doubt this. ------- Additional comments from ab Fri Oct 15 01:09:21 -0700 2004 ------- Reassignment failed... Sorry, I didn't see your 7 PP3 reference and you're right, it really worked in 7 PP3, but only there, not before and not after. As the code is not even com- patible to VB I doubt that this is worth a OOo 2.0 target. And it's still true: The Shell implementation hasn't changed all the time. So only vos::OProcess may have been changed, but maybe this was a bug in PP3? ------- Additional comments from tbo Tue Oct 19 03:03:18 -0700 2004 ------- <grr> yes, in SO7 final it didn't work either. -> target moved to later. Typo in batch name, file extension has to be .bat instead of .sh. -> assigning to vos::OProcess owner ------- Additional comments from obr Tue Oct 19 03:21:39 -0700 2004 ------- obr @ ab: vos::OProcess is deprecated since ages: please use osl::Process instead. BTW: just checked and the maintainer of osl::Process is TRA :-). ==============================================================
Reset assigne to the default "issues@openoffice.apache.org".