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

  • Home
  • SEARCH
  • 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 8344279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:18:56+00:00 2026-06-09T06:18:56+00:00

I am using the exec() function to execute the same external programs, and I

  • 0

I am using the exec() function to execute the same external programs, and I want to stop one of them in some case. But the following command:

taskkill /IM program.exe

will get all program.exe killed. So the best way I thought was to kill program process by its PID.

So,I thought the way was to get the PID every time the program was executed, and then kill it.

I am using PHP 5.3 on Windows XP.

  • 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-09T06:18:58+00:00Added an answer on June 9, 2026 at 6:18 am

    exec on Windows hangs until child process is over. You need PID of a child, so I suppose you want to nohup a child.

    Try this code, it worked for me. It nohups notepad.exe and displays its PID

        $command = 'notepad.exe';
    $WshShell = new COM("WScript.Shell");
    $oExec = $WshShell->exec("notepad.exe");
    print_r ( $oExec->ProcessID ) 
    

    pay attention to $WshShell->exec and not $WshShell->run as some googled ressources claim.

    May it help someone else

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

Sidebar

Related Questions

I am trying to execute the following command in irb, exec 'gcc j.cpp' but,
I am using exec function to execute the specific executable files in php .
I'm using the exec command to call R , but I don't understand how
I am trying to spawn a process using Runtime.exec. I want to use my
I am trying to execute an SOAP-function using cURL (because I get an error
I am trying to Execute a multiple commands in php using exec() and shell_exec
I'm using SQL Server 2005, and want a user defined function to implement the
I'm using sqlite3_exec() function in order to execute an SQL Insert command. The problem
I would not normally use a function to execute code, but my boss is
trying to execute the stored proc in EF using the following code: var params

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.