Process Class Error

The following command and arguments run without any errors if they are run in a batch file.

"C:\Program Files (x86)\Visual CUT 11\Visual CUT.exe" -e "C:\test_3\People_1.rpt" "Export_Format:Adobe Acrobat (pdf)" "Export_File:C:\test_3\People_1.pdf"

However, the app returns an error when the code shown below is run. The code runs in Visual Studio without any errors.

        Dim startInfo As New ProcessStartInfo
        startInfo.FileName = "C:\Program Files (x86)\Visual CUT 11\Visual CUT.exe"
        startInfo.Arguments = "-e C:\test_3\People_1.rpt ""Export_Format:Adobe Acrobat (pdf)"" Export_Mode: Export_File:C:\test_3\People_1.pdf"
        Process.Start(startInfo)


Please help me find the error.
Mark01Asked:
Who is Participating?
 
KimputerCommented:
As you've got it working in a previous solution, use the same line:

startInfo.Arguments = "-e ""C:\test_3\People_1.rpt"" ""Export_Format:Adobe Acrobat (pdf)"" ""Export_File:C:\test_3\People_1.pdf"""

Open in new window

0
 
Miguel OzSoftware EngineerCommented:
Please post error, without it it is hard to find which could be cause of error, I will start by checking  that all required path of your program exist and the user running the program have the required windows permissions.
If it runs in batch and VS in your same PC, it only means you have all paths defined and your user is admin user having access to everything.
0
 
Mark01Author Commented:
Here's the error:
[C:\test_3\People_1.rpt]: All Printing, Exporting, and Emailing options are Turned Off -- Nothing to Process. Perhaps you forgot to provide Export_Mode or Email_Mode arguments.: 1/20/2018 4:39:17 PM

The batch, Visual Cut and VS are on the same machine. I've checked the paths several times today. I am the admin user.
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
ste5anSenior DeveloperCommented:
You have a ExportMode parameter without value in your process call, but not in your batch.
0
 
Mark01Author Commented:
@ste5an. Yes. It does not make any difference in either the batch file or VB app. The results are same with or without it.
0
 
Ryan ChongCommented:
All Printing, Exporting, and Emailing options are Turned Off -- Nothing to Process. Perhaps you forgot to provide Export_Mode or Email_Mode arguments

i guess it probably need this?

startInfo.Arguments = "-e C:\test_3\People_1.rpt ""Export_Format:Adobe Acrobat (pdf)"" ""Export_Mode: Export_File:C:\test_3\People_1.pdf"""

check user manual at page 88:
http://www.milletsoftware.com/Download/Visual_CUT_User_Manual.pdf
0
 
Miguel OzSoftware EngineerCommented:
Uhm please escape double quotes: (Every parameter needs quotes and it mest be space between parameters:
 startInfo.Arguments = ""-e C:\test_3\People_1.rpt ""&" "Export_Format:Adobe Acrobat (pdf)""&" "Export_Mode: Export_File:C:\test_3\People_1.pdf""

Open in new window

0
 
ste5anSenior DeveloperCommented:
??? Have you run a sample using the same parameters as in your batch from your first post?

It should be

Params = @"-e C:\test_3\People_1.rpt ""Export_Format:Adobe Acrobat (pdf)"" Export_File:C:\test_3\People_1.pdf"

Open in new window


btw, you normally need quotes only for parameters or values containing spaces or redirection symbols like the pipe or lesser or greater sign.
Thus is "Export_Format:Adobe Acrobat (pdf)" really correct? Cause I would expect Export_Format:"Adobe Acrobat (pdf)" instead.
0
 
Mark01Author Commented:
@Ryan Chong

Page 88 of the user manual states that if an argument is omitted, that aspect of processing will not take place. No bursting is happening; it is only a single PDF export.

I tried your suggested code and the same error occurred.

Process Code:

Dim startInfo As New ProcessStartInfo
        startInfo.FileName = "C:\Program Files (x86)\Visual CUT 11\Visual CUT.exe"
        startInfo.Arguments = "-e C:\test_3\People_1.rpt ""Export_Format:Adobe Acrobat (pdf) Export_File:C:\test_3\People_1.pdf"""
        Process.Start(startInfo)

Open in new window

Error:

[C:\test_3\People_1.rpt]: All Printing, Exporting, and Emailing options are Turned Off -- Nothing to Process. Perhaps you forgot to provide Export_Mode or Email_Mode arguments.: 1/21/2018 9:04:54 AM


@Miguel Oz

I tried using the following:

startInfo.Arguments = ""-e C:\test_3\People_1.rpt ""&" "Export_Format:Adobe Acrobat (pdf)""&" "Export_Mode: Export_File:C:\test_3\People_1.pdf""

Open in new window

It resulted in numerous VS errors. Here is one error:
Error      1      Operator '-' is not defined for types 'String' and 'System.EventArgs'.      F:\SW_Demos\WinVbTest1_011918\WinVbTest1_011918\WinVbTest1_011918\Form1.vb      51      32      WinVbTest1_011918


The full code:
Dim startInfo As New ProcessStartInfo
        startInfo.FileName = "C:\Program Files (x86)\Visual CUT 11\Visual CUT.exe"
         startInfo.Arguments = ""-e C:\test_3\People_1.rpt ""&" "Export_Format:Adobe Acrobat (pdf)""&" "Export_Mode: Export_File:C:\test_3\People_1.pdf""
        Process.Start(startInfo)

Open in new window

@ste5an

Yes. Visual Cut functions without any errors (successful export) using the batch shown below and the VB Process shown below results in the error shown below.

Batch:
"C:\Program Files (x86)\Visual CUT 11\Visual CUT.exe" -e "C:\test_3\People_1.rpt" "Export_Format:Adobe Acrobat (pdf)" "Export_Mode: " 
"Export_File:C:\test_3\People_1.pdf"

Open in new window

VB Process:
        Dim startInfo As New ProcessStartInfo
        startInfo.FileName = "C:\Program Files (x86)\Visual CUT 11\Visual CUT.exe"
        startInfo.Arguments = "-e C:\test_3\People_1.rpt ""Export_Format:Adobe Acrobat (pdf)"" Export_File:C:\test_3\People_1.pdf"
        Process.Start(startInfo)

Open in new window

Error:
[C:\test_3\People_1.rpt]: All Printing, Exporting, and Emailing options are Turned Off -- Nothing to Process. Perhaps you forgot to provide Export_Mode or Email_Mode arguments.: 1/21/2018 8:56:54 AM

Your suggestion results in a VS error.

VB Process:
        Dim startInfo As New ProcessStartInfo
        startInfo.FileName = "C:\Program Files (x86)\Visual CUT 11\Visual CUT.exe"
        startInfo.Arguments = "-e C:\test_3\People_1.rpt Export_Format:"Adobe Acrobat (pdf)" Export_File:C:\test_3\People_1.pdf""
        Process.Start(startInfo)

Open in new window


VS Error:
Error      1      End of statement expected.      F:\SW_Demos\WinVbTest1_011918\WinVbTest1_011918\WinVbTest1_011918\Form1.vb      51      73      
WinVbTest1_011918
0
 
Miguel OzSoftware EngineerCommented:
My bad we only require quotes for  Export_Format, it should be:
startInfo.Arguments = "-e C:\test_3\People_1.rpt "&""Export_Format:Adobe Acrobat (pdf)""&" Export_Mode: Export_File:C:\test_3\People_1.pdf"

Open in new window

0
 
Mark01Author Commented:
@Miguel Oz

Your code resulted in six VS errors. Three errors are shown below.

The full code:
        Dim startInfo As New ProcessStartInfo
        startInfo.FileName = "C:\Program Files (x86)\Visual CUT 11\Visual CUT.exe"
        startInfo.Arguments = "-e C:\test_3\People_1.rpt "&""Export_Format:Adobe Acrobat (pdf)""&" Export_Mode: Export_File:C:\test_3\People_1.pdf"
        Process.Start(startInfo)

Open in new window


Errors:

Error      1      End of statement expected.      F:\SW_Demos\WinVbTest1_011918\WinVbTest1_011918\WinVbTest1_011918\Form1.vb      51      62      WinVbTest1_011918

Error      2      Name 'Adobe' is not declared.      F:\SW_Demos\WinVbTest1_011918\WinVbTest1_011918\WinVbTest1_011918\Form1.vb      51      76      WinVbTest1_011918

Error      3      Method arguments must be enclosed in parentheses.      F:\SW_Demos\WinVbTest1_011918\WinVbTest1_011918\WinVbTest1_011918\Form1.vb      51      82      WinVbTest1_011918
0
 
Ryan ChongCommented:
found this article:

ProcessStartInfo.Arguments Property
https://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.arguments(v=vs.110).aspx

apparently, it need to use 3 quotes in order to pass double quotes as arguments.

hence, try this instead:

startInfo.Arguments = "-e """"""C:\test_3\People_1.rpt"""""" """"""Export_Format:Adobe Acrobat (pdf)"""""" """"""Export_Mode: Export_File:C:\test_3\People_1.pdf"""""""

Open in new window

0
 
Mark01Author Commented:
I just ran your code and got the Visual Cut error shown below.

Full Code:
        Dim startInfo As New ProcessStartInfo
        startInfo.FileName = "C:\Program Files (x86)\Visual CUT 11\Visual CUT.exe"
        startInfo.Arguments = "-e """"""C:\test_3\People_1.rpt"""""" """"""Export_Format:Adobe Acrobat (pdf)"""""" """"""Export_Mode: Export_File:C:\test_3\People_1.pdf"""""""
        Process.Start(startInfo)

Open in new window

Error:
Command Line Processing for ["""C:\test_3\People_1.rpt"""] Failed: Argument Not Recognized [""Export_Format]. Spelling Mistake?: 1/22/2018 5:40:29 PM
0
 
Mark01Author Commented:
I just tried triple quotes around the final argument but got the Visual Cut error shown below.

Full Code:
        Dim startInfo As New ProcessStartInfo
        startInfo.FileName = "C:\Program Files (x86)\Visual CUT 11\Visual CUT.exe"
        startInfo.Arguments = "-e C:\test_3\People_1.rpt ""Export_Format:Adobe Acrobat (pdf)"" """"""Export_File:C:\test_3\People_1.pdf"""""""
        Process.Start(startInfo)

Open in new window


Error:
Command Line Processing for ["""C:\test_3\People_1.rpt"""] Failed: Argument Not Recognized [""Export_Format]. Spelling Mistake?: 1/22/2018 5:40:29 PM
0
 
Ryan ChongCommented:
i don't have visual cut installer so can't really test for you.

so you got to twist a bit the codes to make it works.

i got codes like below:

Dim startInfo As New ProcessStartInfo
        startInfo.FileName = "D:\Projects\Others\EE\29079424\test\bin\Debug\test.exe"
        startInfo.Arguments = "-e """"""C:\test_3\People_1.rpt"""""" """"""Export_Format:Adobe Acrobat (pdf)"""""" """"""Export_Mode: Export_File:C:\test_3\People_1.pdf"""""""

        Process.Start(startInfo)

Open in new window


and i got this as a return:

-e "C:\test_3\People_1.rpt" "Export_Format:Adobe Acrobat (pdf)" "Export_Mode: Export_File:C:\test_3\People_1.pdf"

Open in new window

0
 
Mark01Author Commented:
I found a code sample and tried it but got VS errors.

Sample:
'https://www.dotnetperls.com/process-vbnet

        '
 Use these arguments for the process
        '        p.Arguments = "a -tgzip """ & targetName & """ """ &
        '           sourceName & """ -mx=9"

Open in new window


My code:
        Dim startInfo As New ProcessStartInfo
        startInfo.FileName = "C:\Program Files (x86)\Visual CUT 11\Visual CUT.exe"
        startInfo.Arguments = "-e C:\test_3\People_1.rpt """ & Export_Format: Adobe(Acrobat (pdf) & """ Export_File:C:\test_3\People_1.pdf")"
        Process.Start(startInfo)

Open in new window

VS Errors:
Error      1      Name 'Export_Format' is not declared.      F:\SW_Demos\WinVbTest1_011918\WinVbTest1_011918\WinVbTest1_011918\Form1.vb      62      64      WinVbTest1_011918

Error      2      Name 'Adobe' is not declared.      F:\SW_Demos\WinVbTest1_011918\WinVbTest1_011918\WinVbTest1_011918\Form1.vb      62      79      WinVbTest1_011918
0
 
Ryan ChongCommented:
Error      1      Name 'Export_Format' is not declared.      F:\SW_Demos\WinVbTest1_011918\WinVbTest1_011918\WinVbTest1_011918\Form1.vb      62      64      WinVbTest1_011918

Error      2      Name 'Adobe' is not declared.      F:\SW_Demos\WinVbTest1_011918\WinVbTest1_011918\WinVbTest1_011918\Form1.vb      62      79      WinVbTest1_011918

this line of your code is wrong:

startInfo.Arguments = "-e C:\test_3\People_1.rpt """ & Export_Format: Adobe(Acrobat (pdf) & """ Export_File:C:\test_3\People_1.pdf")"

you are generating something like:

-e C:\test_3\People_1.rpt " ... (wrong syntax after that)

p.Arguments = "a -tgzip """ & targetName & """ """ &
                   sourceName & """ -mx=9"
this was what original suggested but apparently the double quotes were being removed and not passed as part of arguments.
0
 
Mark01Author Commented:
@Kimputer: All that happens is Visual Cut starts and runs. No PDF export happens. There are no VS or Visual Cut errors.

Full Code:
      Dim startInfo As New ProcessStartInfo
        startInfo.FileName = "C:\Program Files (x86)\Visual CUT 11\Visual CUT.exe"
        startInfo.Arguments = startInfo.Arguments = "-e ""C:\test_3\People_1.rpt"" ""Export_Format:Adobe Acrobat (pdf)"" ""Export_File:C:\test_3\People_1.pdf"""
        Process.Start(startInfo)

Open in new window

0
 
Mark01Author Commented:
@Kimputer: Your code worked. I will award points and close the question soon.

Full Code:
        Dim startInfo As New ProcessStartInfo
        startInfo.FileName = "C:\Program Files (x86)\Visual CUT 11\Visual CUT.exe"
        startInfo.Arguments = "-e ""C:\test_3\People_1.rpt"" ""Export_Format:Adobe Acrobat (pdf)"" ""Export_File:C:\test_3\People_1.pdf"""
        Process.Start(startInfo)

Open in new window

0
 
Ryan ChongCommented:
sigh, i almost there with:

startInfo.Arguments = "-e C:\test_3\People_1.rpt ""Export_Format:Adobe Acrobat (pdf)"" ""Export_Mode: Export_File:C:\test_3\People_1.pdf"""

posted in ID: 42441469

and:

startInfo.Arguments = "-e """"""C:\test_3\People_1.rpt"""""" """"""Export_Format:Adobe Acrobat (pdf)"""""" """"""Export_Mode: Export_File:C:\test_3\People_1.pdf"""""""

posted in ID: 42443227

probably missing some magic somewhere.
0
 
Mark01Author Commented:
Thank you, Kimputer, Miguel Oz, Ryan Chong and ste5an.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.