Executing a program and passing parameters using ProcessStartInfo

I am trying to run an application and pass parameters from within a c# desktop application.  It appears to attempt to execute but it doesn’t run and the exeProcess shows errors in the locals.
Here is the code:
ProcessStartInfo startBin2TextApp =
new
ProcessStartInfo(strNowRunThis, strDataFile +
" a");
startBin2TextApp.CreateNoWindow =
true;
startBin2TextApp.UseShellExecute =
false;          startBin2TextApp.WindowStyle =
ProcessWindowStyle.Hidden;
Process exeProcess =
null;
exeProcess = Process.Start(startBin2TextApp);
This is what is in the Arguments when Process.Start(startBin2TextApp) is ready to execute.
Arguments         "C:\\Users\\10065421\\Documents\\ab\\Working\\Projects\\Panel Explorer\\B640130A.DAT a"             
After the line is executed, exeProcess shows an error in most of the attributes.  For instance, BasePriority shows “exeProcess.BaePriority” threw an exception of type “System.InvalidOperationException”.
I ran this from the command prompt so I know it runs on this machine with the same parameters I am using in the code.
Any ideas?
Thanks.

Here is the complete code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Diagnostics;
using System.Threading.Tasks;
namespace PanelExplorerV1
    public
class
CommonCode
public
delegate
void
PassStatusBackFunction(string
msg);
public
void RunBinToText(PassStatusBackFunction
messageCallback)
try
string strStartDirectory =
string strDataPath =
string strDataFile =
string strDataFileTitle =
string strBin2TextPath =
string strDestinationDirectory;
string strNowRunThis =
//int intReturnValue = 0;
                strStartDirectory =
Application.StartupPath;
OpenFileDialog dlgCommonDialog =
new
OpenFileDialog();
//CommonDialog dlgCommonDiaglog = new CommonDialog();
                dlgCommonDialog.FileName =
//dlgCommonDialog.CancelError = true;
                dlgCommonDialog.Filter =
"Binary Data Files (*.dat)|*.dat|All Files (*.*)|*.*";
                dlgCommonDialog.ShowDialog();
                strDataFile = dlgCommonDialog.FileName;
                strDataFileTitle = dlgCommonDialog.Title;
                if
(strDataFile.Length == 0)
return;
                strDataPath =
Path.GetDirectoryName(strDataFile);
object argumentHolder = 1;
                messageCallback("Extracting data from
" + strDataFile +
"!!!  Please Wait");
                strBin2TextPath = strStartDirectory +
"\\" +
"Bin2Txt.exe";
                strDestinationDirectory = strDataPath +
"\\" +
"Bin2Txt.exe";
                System.IO.File.Copy(strBin2TextPath,
strDestinationDirectory);
                strNowRunThis = strDestinationDirectory;
ProcessStartInfo startBin2TextApp =
new
ProcessStartInfo(strNowRunThis, strDataFile +
" a");
                startBin2TextApp.CreateNoWindow =
true;
                startBin2TextApp.UseShellExecute =
false;         
                startBin2TextApp.WindowStyle =
ProcessWindowStyle.Hidden;
                Process
exeProcess = null;
                exeProcess =
Process.Start(startBin2TextApp);
                messageCallback("Finished Extracting
data from " + strDataFile);
return;
catch (InvalidOperationException
inEx)
Console.WriteLine(inEx.Message);

Similar Messages

  • I need to call a java program and pass parameters from C#

    I'm new to C# and was given a project to rewrite some of my old VB.net programs to C# to help me learn.  These VB programs call quite a few .bat files that have calls to java programs in them. I'm doing okay converting my VB code, but I've been
    stumped for days trying to figure out how to call java from C#. 
    Does anyone here know how to do this?  I really should've had this figured out by now and my back is to the wall.  Ugh :(
    This is the line from the .bat file that I need to convert to C#. 
    call jvbat production_r115.Automotive m:\data\MK115mn.100 m:\data\MK115mn.101 %6
    There is one parameters being passed, %6
    I would be forever grateful if someone can show me how to do this!

    Hi Joni,
    Do you mean call a bat file that it is a Java program from C#?  If so, there is an article talking about it.
    If that's not what you're trying to do, please be more specific about what you're trying to do.
    http://www.c-sharpcorner.com/UploadFile/maheswararao/CallingJavaProgramfromCS12062005233321PM/CallingJavaProgramfromCS.aspx
    Now the next issue is pass some parameters from C#.
    The above article tells using Process.Start() method to call java program. Also  in this class, you could  specify them all in the
    Arguments property:
    var p = new Process();
    p.StartInfo.Arguments = string.Format("{0} {1}", argument1, argument2);
    For more detailed information, please refer to
    C# Passing Multiple Arguments to BAT File
    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control
    these sites and has not tested any software or information found on these sites;
    Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information
    found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Shell script calling SQL Program and passing parameters

    Hi guys,
    Greetings from Toronto. Is it possible to pass a string or strings as parameters to a sql program from a shell script ?
    Shell Script
    # Accept system input parameters
    p_user_id=$1
    p_job_id=$2
    sqlplus.exe -s $p_user_id @$RD_PATH/rd_test.sql $p_user_id $p_job_id
    SQL Program (rd_test.sql)
    -- Accept system input parameters
    define p_user_id = &1
    define p_job_id = &2
    -- Wondering if its possible to pass these 3 parameters from a shell script program.
    -- (1) rd_test-$p_job_id-3-1.lis
    -- (2) RD_PRINTER(rd_test,3)
    -- (3) t_data
    select
    t_data=''rd_test-'||'''$p_job_id'''||'-1-1.txt''
    t_data_dir=''.''
    ksh $RD_PATH/another_shell_prog.sh $p_user_id $p_job_id '||a.rd_value||' '
    ||b.rd_value||' rd_test-$p_job_id-3-1.lis $RD_PRINTER(rd_test,3) '||
    '$t_data $t_data_dir'||'
    exit_status=$?
    check_command'
    from rd_job_parameter b, rd_job_parameter a
    where a.job_id = &2
    and a.jp_module_id = 'RDTEST'
    and b.job_id = a.job_id
    and b.module_id = a.module_id
    /As always, its not something I have to solve this minute. Any help would be appreciated
    and I will be thinking of the problem.
    Thanks
    Raj
    Edited by: Raj404261 on Jun 25, 2009 11:40 AM
    Edited by: Raj404261 on Jun 25, 2009 5:29 PM

    Hi Sean,
    Thanks for the reply. I am not at work yet. I already do have the if condition to call 2 separate sql scripts. I was hoping them to be reduced to one sql script. That's why I was hoping to pass some of those values to the select statement as parameters.
    Here is what I was hoping to pass from the shell script based on an IF condition. The good thing about it is that I can hard code these 3 parameters in the shell script in the IF and ELSE conditions. Is it possible to tag these 3 hard coded values in the command line after $p_job_id and then capture these 3 parameters in the SQL program ?
    1. rd_test-$p_job_id-3-1.lis or rd_test-$p_job_id-3-1.lis
    2. RD_PRINTER(rd_test,3) or RD_PRINTER(rd_test,4)
    3. t_data=''rd_test-'||'''$p_job_id'''||'-1-1.txt''
    Shell script :
    # Accept system input parameters
    p_user_id=$1
    p_job_id=$2
    if [condition]
       sqlplus.exe -s $p_user_id @$RD_PATH/rd_test.sql $p_user_id $p_job_id
    else
       sqlplus.exe -s $p_user_id @$RD_PATH/rd_test.sql $p_user_id $p_job_id
    fi
    ksh $RD_PATH/another_shell_prog.sh $p_user_id $p_job_id '||a.rd_value||' '
    ||b.rd_value||' rd_test-$p_job_id-3-1.lis $RD_PRINTER(rd_test,3) '||
    '$t_data $t_data_dir'||'

  • How to open a page from a Form and pass parameters to the form on that page

    I found a similar example on this forum, but it did not work for me:
    declare
    l_names owa.vc_arr;
    l_values owa.vc_arr;
    i number;
    begin
    PORTAL.wwpro_api_parameters.retrieve(l_names, l_values);
    FOR i in 1..l_names.count
    LOOP
    htp.p(l_names(i) || ' ' || l_values(i));
    END LOOP;
    end;
    By using this method i get the parameters for the Form, like the session ID, but not the parameters for the Page that the form is displayed in.
    Another method I tried:
    To open a Form from a Form and pass parameters works fine like this:
    --In the After processing page PL/SQL event.
    declare
    v_id number;
    blk varchar2(10):='DEFAULT';
    Begin
    v_id:=p_session.get_value_as_number (p_block_name=>blk,p_attribute_name=>'A_ID');
    if v_id > 0 then
    htp.formOpen('PORTAL.wwa_app_module.link?p_arg_names=_moduleid&p_arg_values=2649500412&p_arg_names=_show_header&p_arg_values=YES&p_arg_names=ID&p_arg_values='||to_char(v_id),'post');
    htp.formSubmit(NULL,'Upload Files');
    htp.formClose;
    end if;
    End;
    But I want to open a Page containing the Form instead of just opening the Form. Is this possible to open a Page and pass paramters to the page, and then let the form inside the Page access the passed paramters. The reason for this is that a Form cannot be based on a page template, or can it? When opening the form i want to keep the left menu, which I can if it is a page based on my template with the left menu.
    Best regards
    Halvor

    Hi,
    You can do this by calling the url of the page with the form. You can then use p_arg_names and p_arg_values to pass parameters. In the called form you can get the value from p_arg_names and p_arg_values and assign it to the form field.
    You can call this code in the success procedure of the calling form.
    declare
    v_id number;
    blk varchar2(10):='DEFAULT';
    v_url varchar2(2000);
    Begin
    v_id:=p_session.get_value_as_number (p_block_name=>blk,p_attribute_name=>'A_ID');
    v_url := <page_url>;
    if v_id > 0 then
    call(v_url||'&p_arg_names=id&p_arg_values='||v_id);
    end if;
    End;
    In the called form in "Before displaying form" plsql section write this code.
    for i in 1..p_arg_names.count loop
    if p_arg_names(i) = 'id' then
    p_session.set_value(
    p_block_name => blk,
    p_attribute_name => 'A_ID',
    p_value => p_arg_values(i)
    end if;
    end loop;
    This code picks up the value from p_arg_values and assigns it to the form field.
    Hope that helps.
    Thanks,
    Sharmila

  • Connecting Crystal reports with dashboards and passing parameters

    Hi ,
    Can anyone have any document on Connecting Crystal reports with dashboards and passing parameters.
    I would appreciate for this.
    Thank You.

    Hi Ganesh,
    You can refer the following links for connecting Crystal reports with dashboards:
    Dashboard integration in Crystal Reports using flash variables | Clariba Blog
    https://websmp102.sapag.de/~sapidp/011000358700001426732009E/Xcelsius_EmbeddingInCR2008.pdf
    http://events.asug.com/2012BOUC/0315_Integrating_SAP_Dashboards_into_SAP_Crystal_Reports.pdf
    Regards,
    Renu

  • Linking form and report and passing parameters

    Is it possible to call a link with parameter from form to report? Let's say I have a form based on EMP table and when user clicks on DEPT_ID label I want to pass DEPT_ID as a parameter to a report showing detailed information about this department. All my attempts to do it were unsuccessful.
    I've seen many questions like this in this thread and most answers refer to Portal FAQ document but there is NO information there on linking form forms to reports and passing parameters between them.
    Any help will be greatly appreciated!
    Thanks.
    null

    This can be easily done. First open up two instances of your Portal. In one window, you will need to go into your component you wish to link FROM. In the other window you will need to go into your component you wish to link TO. In the component you wish to link TO there will be a moduleid. Note this somewhere. Then, you will see an area that says: "Call Interface: Show". Click on this. (In the window you are linking to.). In this window, you will see a bunch of stuff. At the bottom you will see a URL call. This is the call you need to use. At the top, it explains each piece of the URL call. Just subsitute YOUR appropriate information into the URL call. In the form you wish to link FROM, you will need to create a button. Just click on the green plus sign at the top of the screen (when in edit mode) and then declare it a button by using the Item Type drop down. Once you create this button, it will appear at the bottom, click on it and you will see an area to insert a Javascript. Click the onClick and insert:
    get_field_name = getField(this.form,'COLUMN_NAME_IN_DATABASE');
    window.open('/pls/cc_prod/DAD_NAME.wwa_app_module.link?p_arg_names=_moduleid&p_arg_values=MOD_ID_HERE&p_arg_names=_sessionid&p_arg_values=&p_arg_names=COLUMN_NAME_IN_DATABASE&p_arg values='+GETFIELD_NAME+'&p_arg_names=_COLUMN_NAME_IN_DATABASE_cond&p_arg_values=%3D');
    In the fourth tab, where it says, "....before displaying form" insert the following: (This will tell the form how to handle the getField function.)
    htp.p('<script language="JavaScript1.3">
    < !--
    function getField(form,fieldName)
    var objName = "";
    var tmp = "";
    var dAction = "";
    var sel_idx = 0;
    var cnt = 0;
    var instance = 0;
    var slicedName;
    var fillData = new Array();
    for (var i = 0; i < form.length; i++)
    slicedName = form.elements.name.split(".");
    tmp = slicedName[2];
    instance = parseInt(slicedName[3],10);
    if (!tmp)
    continue;
    objName = tmp;
    if (objName == fieldName)
    return form.elements[i].value;
    //-->
    </script>');
    I hope this helps.
    null

  • How to create documentation for report programs and how to use it

    how to create documentation for report programs and how to use it in the selection screen by placing an icon in the Applicatin Tool bar. If i click this icon the help documentation has to display.
      Note: Exaple <b>RSTXSCRP</b> programs selection screen

    Hi
    1 goto SE38 transaction, give the program name
    2 Click on documentation radiobutton & then press change
    3 Write your PURPOSE, PREREQUISITES etc details
    4 Save the same & Activae it.
    The icon will come automatically on selection screen
    Thanks
    Sandeep
    Reward if useful

  • How to find which programs (and other objects) use the field LGORT

    Hi, Im an Abap freshman, and I have been asked to search all programs and objects that use the field LGORT (Storage Location), regardless of what table it is in.
    Is it possible to do it using the "Where-Used List"?
    This will be important since a new Storage Location will be created for MM, and we have to assure that no other programs that reference to it will be affected.
    I would appreciate any help. Thanks!!

    Hi George,
    Go to transaction SE11, choose radiobutton Data Element then enter the name LGORT. Now using the where-used-list in the toolbar, choose programs checkbox in the subsequent dialog and press enter. It should show all programs using the field LGORT irrespective of table name.
    Hope this helps.
    Cheers,
    Sougata.
    Using ECC6.0

  • I just installed MacOS X Yosemite on my MacBook Air 2011.  After installing Yosemite I installed the Photoshop Elements 12.1 upgrade, but now when I open the program and try to use the tools, the program freezes.  How do I fix this problem?

    I just installed MacOS X Yosemite on my MacBook Air 2011.  After installing Yosemite I installed the Photoshop Elements 12.1 upgrade, but now when I open the program and try to use the tools, the program freezes.  How do I fix this problem?

    If you use a trackpad and don't want to switch to a mouse, you can uninstall and reinstall all day long and will still have problems, but if you really want to try it, you can download PSE 12 here:
    Download Photoshop Elements products | 12, 11, 10

  • Hello is Dreamweaver program and muse  both used for making a website and putting it online ?

    Hello is Dreamweaver program and muse  both used for making a website and putting it online ?

    Muse might be all you need for now, but be prepared to keep using Muse for the life of your site.  It doesn't import well into other HTML Editors.  Keep in mind that Muse is not intended for advanced web sites. It can't support  dynamic data, shopping carts, blogs or content management systems. But it's fine for simple static HTML sites.
    Nancy O.

  • Firing an external app from flash and pass parameters

    Hi all,
    I need to fire an exe from flash projector and pass it a lot
    of parameters(need to regenerate an image). Could someone tell me
    what would be the best solution for this... can I make a php
    executable which could use all the gd functions? If yes, can you
    please write a brief tut or provide some guidelines.
    Thanks

    then use:
    fscommand("exec", "correctanswer.exe");

  • Passing Parameters using key mapping in web envirnment

    if I use the url for passing parameters directly to report as
    http://appserver/dev60cgi/rwcgi60?report=inv.rep+server=server=repserver+userid=scott/tiger@db+param1=1+param2=2+DESTYPE etc;
    it works fine but Now the problem is I m using key mapping to hide username and password for this the url is
    http://appserver/dev60cgi/rwcgi60?mapkey+report=inv.rep+server=repserver+param1=1+param2=2;
    where mapkey is defined in CGIcmd.dat file as
    mapkey := scott/tiger@db
    I have checked by rearranging the order of paramerters but still get error.
    Oracle Reports Server CGI - Reports Server name is not specified.
    but I m mentioning the server name as server=repserver
    Hope to get it soon
    Thnx in advance

    You key defined in the cgicmd.dat file should be:
    mapkey := userid=scott/tiger@db *
    You need parameter name 'userid=' before scott, and need space character and '*' in the line. Without '*', cgi won't take any more parameter from the URL after the key, so '+report=inv.rep+server=repserver+param1=1+param2=2' is ignored if there is no '*' for mapkey.

  • File to File and then Call ABAP Program and pass file name and location

    Hi
    I am new to PI and am working on the following requirement and some guidance would help:
    A file is picked up from a third party server using FTP and is put in an SAP server in a specific location. After I have put in the file successfully, I need to call an ABAP program and provide the name and location of the file for further processing by the ABAP program.
    Although I am familiar with File to File, how can I add in the ABAP call with the filename and location? I do not want to pass any other information to the ABAP program.
    Thanks for your help.
    Manoj

    I think I get what you're saying. This additional file would have the file and the path in it's content. I would then use this as a source (FCC?) for Mapping with the RFC. Right?
    Exactly and yes, FCC would be helpful
    Would you have a sample OS script to do the above?
    Actually it depends on the operating system on which your PI system is standing. For instance for Windows, you might try with the following as a start point (but I was not able to test it, so I can't guarantee it will do the job):
    cmd.exe /C "%f %F > C:\target_directory\%DATE%_%TIME%.txt"
    In case you needed more, try googling on "windows batch script" or similar.
    Hope this helps,
    Greg

  • Wesite Login and navigate to reports page and pass parameters to the forms page and download file

    Hello,
    New to C# scripting in SSIS. Everyday I download data file from a website. I need to schedule a page to include a script to auto download from the website everyday by navigation to reports page and submenu for a particular report. After I click it opens
    a webpage where I need to select my criteria and download the file to a table. This is what so far I got
    Object mySSISConnection = Dts.Connections["websiteConnectionManager"].AcquireConnection(null);
    MessageBox.Show("Success")
    I got the success message. After login, I need to navigate to select reports and then from submenu select the everyday report and pass the input parameters to the webpage and download the file and export to a tables. Any help. Not much coding I know. Learning!!
    Any help really appreciate it.
    Thanks
    Jagan

    Whoever instructed you to so is not prudent, once the report definition changed the package will break.
    This is not the proper data interexchange.
    Here is though an example on how to generate a SSRS report and download as a file: http://sandeep-aparajit.blogspot.ca/2010/02/how-to-execute-and-save-ssrs-report.html
    And then to load the file into OLEDB destination http://www.daimto.com/ssis-lesson-2-first-package/
    Arthur
    MyBlog
    Twitter

  • Html:link submit and passing parameters

    I need to submit the form when the <html:link ..... > is clicked/pressed and also need to pass parameters.
    <jsp:useBean id="mapParams" class="java.util.HashMap"/>
    <c:set target="${mapParams}" property="theKey" value="${theValue}"/>
    <c:set target="${mapParams}" property="theKey1" value="${theValue1}"/>
    <html:link href="javascript:document.myform.submit()" name="mapParams" >
    <c:out value="${custItr.empName}"/>
    </html:link>
    When i click on the link getting javascript error which says "syntax error". when I remove the "name" attribute in <html:link> there is no error but I need to have the name attribute to pass the parameters.
    How to do both the submit and passing of parameters using <html:link>? Your help is appreciated.
    Thanks.

    Parameters can only be passed like that to an actual URL. eg http://localhost:8080/myApp/showEmployee?id=123&dept=Sales
    In this case, you are using the link tag to invoke javascript - not a url. URL Parameters don't apply to this string
    If you are indeed submitting a form, I would suggest that you instead go with putting hidden fields on the form to submit the value.
    Use <html:hidden>

Maybe you are looking for

  • Microsoft Word 7 and Adobe PDF 9

    When converting a Word document to PDF and by chance you need to edit the PDF using the touch up text tool, we have users that are having problems with character spacing and lines moving. It only happens after you save the document. Does anyone know

  • Fullscreen apps forget their state

    If I have an application in fullscreen (Safari, Mail, iCal etc) and close its windows without quitting the application two things happen: 1     the Menubar disappears. 2     if I then open the application again from the Application Switcher or the Do

  • Clip looks different in every single editor/player? (Canon Vixia)

    Hi guys, I have a new camcorder and am trying to understand how things work... I recorded a short clip and then realized it looks notably different in every app I play it back in, even if they're all set to 100% zoom. While it doesn't look incredibly

  • To retrieve taxation details

    hello everyone.       I have a scenario  where i have to retrieve and display BED  and VAT values from database.      Where i am finding the same fields and tables for the above two values!. Can anyone please explain the procedure to retrieve those v

  • My songs are listed as albums, artists, etc.

    I got the new 30gig i-pod video today. I bought an album from i-tunes and loaded it on my new i-pod. The problem is that it listed all of the songs in every catagory on the i-pod. So when I go into the albums folder it shows all of the songs in the a