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 9008143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:52:20+00:00 2026-06-16T01:52:20+00:00

I am trying to get Phantom.JS to run on a Windows computer and I

  • 0

I am trying to get Phantom.JS to run on a Windows computer and I have it working as a BAT file. I can open a console window, launch the BAT file and everything appears to work. That said, the output is too long for the console so I want to run the same thing inside of a .NET Console application. I have tried numerous things but I keep getting an error ‘phantom.js is not recognized as an internal or external command’

The BAT file itself consists of the following command:

phantomjs --config=config.json netsniff.js http://google.com 

Here is my .NET code:

Process compiler = new Process();
compiler.StartInfo.FileName = "cmd.exe"; 
compiler.StartInfo.Arguments = "/C C:\\Test\\getpage.bat";
compiler.StartInfo.UseShellExecute = true;
compiler.Start();

Can somebody please help me figure out what I am doing wrong? Thank you!

Thank all of you for figuring this out for me. Here is a working solution:

Process compiler = new Process();
compiler.StartInfo.FileName = "cmd.exe";
compiler.StartInfo.WorkingDirectory = "C:\\Test\\";
compiler.StartInfo.Arguments = "/r getpage.bat";
compiler.StartInfo.UseShellExecute = false;
compiler.StartInfo.RedirectStandardOutput = true;
compiler.Start();

File.WriteAllText("C:\\Test\\pageoutput.txt",compiler.StandardOutput.ReadToEnd());

compiler.WaitForExit();
  • 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-06-16T01:52:21+00:00Added an answer on June 16, 2026 at 1:52 am

    you specify the bat location as the filename not cmd.exe

    Process compiler = new Process();
    compiler.StartInfo.FileName = "C:\\Test\\getpage.bat"; 
    compiler.StartInfo.UseShellExecute = true;
    compiler.Start();
    

    although I don’t see the specific need for the bat file. you could just do something like:

    Process compiler = new Process();
    compiler.StartInfo.FileName = DirectoryToPhantomJs + "phantomjs"; 
    compiler.StartInfo.Arguments = "--config=config.json netsniff.js http://google.com ";
    compiler.StartInfo.UseShellExecute = true;
    compiler.Start();
    

    the benefit of the second approach is you’re explicitly specifying the location of phantom js so you shouldn’t get the ‘phantom.js is not recognized as an internal or external command’ error.

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

Sidebar

Related Questions

I am trying get my head around how you can run the following php:
I can't get facelets file to load into a template. I have a content
I am trying get my first simple project in rails to run. I have
Trying to get this expression to work, can someone look at it and tell
I'm trying get some licensing code from AndroidPit.com working, but I get Unable to
Hello everyone I been trying get php uploader working but having a lot of
Trying to get all articles, with unique titles (distinct(title)), that have a body of
I'm trying to get FlashPunk working in the Flash CS5 IDE (don't ask), and
I'm trying get all the button child widgets of a window. The buttons were
I'm trying get my site to error out if the file uploaded ins't a

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.