Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 491593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T02:01:37+00:00 2026-05-13T02:01:37+00:00

I was following one of the thread to run perl scripts from my c#

  • 0

I was following one of the thread to run perl scripts from my c# program.

My c# code is like this:

   private void RunScript(ArrayList selectedScriptFileList)
    {
        foreach (var curScriptFileName in selectedScriptFileList)
        {
            ProcessStartInfo myProcessStartInfo = new ProcessStartInfo("perl.exe");
            myProcessStartInfo.Arguments = (string)(curScriptFileName);
            myProcessStartInfo.UseShellExecute = false;
            myProcessStartInfo.RedirectStandardOutput = true;
            myProcessStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            myProcessStartInfo.CreateNoWindow = true;
            myProcess.StartInfo = myProcessStartInfo;


            myProcess.Start();
            myProcess.WaitForExit();
            string output = myProcess.StandardOutput.ReadToEnd();
            this.ScriptTestResultTextBox.AppendText(output);
        }            
    }

And my perl script requires XML parsing. I can read the print statement before the XML parsing, but not after the parsing starts. The script runs find on DoS shell.

Here is part of my script:

print("\n");
print("****************** test1.pl ***********************\n");
print("\n");

print("1");
print("2");

my $scriptName = 'test1.pl';
my $file = '../../ScriptParamLib.xml';
my $parser = XML::LibXML->new();
my $tree = $parser->parse_file($file);
my $root = $tree->getDocumentElement;
my @species = $root->getElementsByTagName('test_node');

print("Accessing XML Data Base...\n");

The c# testbox only shows the first three print statement but not the last one.
Does anybody knows why?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T02:01:38+00:00Added an answer on May 13, 2026 at 2:01 am

    I figured I should roll my comments into an answer since they proved to be helpful:

    Since using an absolute path for $file in the Perl script works, the issue most likely has something to do with the working directory of the process that gets spawned from the C# program. You can use the Cwd module in the Perl script to see what the working directory actually is. If it’s not what you expect, try setting it via the WorkingDirectory property of ProcessStartInfo in your C# program. Relative paths should work just fine after that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say that I have the following code that's run in one thread of
Assume I have one threadpool and each thread is running following method: void runMe(HashMap
I have the following locking mechanism for my class. When I run this program,
I would like to be able to force a context switch from one thread
In an interactive session like the following one: >>> f=open('test.txt','w') >>> f <open file
I have a model like the following one: public class TestModel{ public IList<Field> Fields
The following program is essentially the same as the one described here . When
We have a thread program that sends bulk mail. The information like 1. To
In the following example, one thread is sending messages via a ByteBuffer which is
I have this following code fragment which is accessed by different threads. try {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.