Skip to content

Parameter with spaces and quotes fails to execute #107

@tomasr78

Description

@tomasr78

I need to execute an obscure LibreOffice command line from C#. It works fine from the command line, but it always fails when using Medallion.Shell with the parameter '--convert-to' and value 'csv:"Text - txt - csv (StarCalc)":44,34,76,1,-1'.

"C:\Program Files\LibreOffice\program\soffice.exe" --convert-to csv:"Text - txt - csv (StarCalc)":44,34,76,1,-1 C:\test.xlsx --outdir C:\_temp\

Medallion.Shell code is below but failing.

    var command = @"C:\Program Files\LibreOffice\program\soffice.exe";
    var args = new[]
    {
        "--convert-to",
        "csv:\"Text - txt - csv (StarCalc)\":44,34,76,1,-1",
        "C:\\test.xlsx",
        "--outdir",
        "C:\\_temp\\"
    };

    var result = Command.Run(command, args);  //runs the command
    result.Wait();

If I remove :"Text - txt - csv (StarCalc)":44,34,76,1,-1 it works, but I need those parameters.

        var command = @"C:\Program Files\LibreOffice\program\soffice.exe";
        var args = new[]
        {
            "--convert-to",
            "csv",
            "C:\\test.xlsx",
            "--outdir",
            "C:\\_temp\\"
        };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions