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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:28:02+00:00 2026-06-12T15:28:02+00:00

I’d like to use Python 2.6 on Windows to launch several separate command windows,

  • 0

I’d like to use Python 2.6 on Windows to launch several separate command windows, each running their own Python script. The purpose is: these are clients, and I’m trying to load up the server with requests from multiple quasi-independent clients.

I don’t need to communicate with the client during or after the run, but I do need to send each a different commmandline arg, and I’d like each client’s output to scroll in its own “console”.

From the DOS command line, the “start” command does what I’d like. I can either:

start perf_test.py 2

or

start cmd /c perf_test.py 3

or

start cmd /c python perf_test.py 4

(These will work for you if you have your “file associations” setup correctly for *.py files. There are other threads on that, if you need help. Or, use full paths to the python exe and/or your script.)

My challenge is: How do I get the same effect from Python?

Using subprocess library, I’ve tried variations like this:

from subprocess import *
p = Popen(["perf_test.py", "4"], shell=True, stdin=PIPE)

But even with shell=True, the output is commingled in the window I’m already running in. Adding stdout=PIPE stops that, but then I have to read p.stdout or use p.communicate(). Adding “cmd” to the Popen gets approximately the same:

p = Popen(["cmd", "/c", "perf_test.py", "4"], shell=True, stdin=PIPE)

None of the above achieve the effect I’m looking for, which is: “pop open a new, distinct window for this script, and watch its output scroll by in its own console” (because I really want to run N of these clients in parallel).

One other thing I turned to almost works, too.

import os
os.startfile("perf_test.py")

This returns immediately, and an actual dosbox pops up. Yay! Success! That is, until I try to add an argument. This fails:

os.startfile("perf_test.py 5")

with error “The system cannot find the file specified”… because it is adding “[SPACE]5” to the filename. (The purpose of the argument is that each “perf_test” needs to have an assigned ID, so that they hit the server as different instances.)

Other approaches I’ve considered, and really don’t like for various reasons:

  • Run each “perf_test” in its own thread. (But I really want to see the output each in its own console.)
  • Make my own pseudo-consoles with Tk. (Figure I’ll just hit different threading problems there.)
  • Dynamically write a .BAT file on the fly with the lines “start perf_test.py 1”, “start perf_test.py 2”, etc., then launch that .BAT file with Popen or startfile.

I expect the last will work… and I guess is my last resort, if I can’t get a Python script to do it directly.

Thanks for any input / insights!

  • 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-12T15:28:03+00:00Added an answer on June 12, 2026 at 3:28 pm

    You can use:

    import os
    os.system("start python perf_test.py 5")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I've got a string that has curly quotes in it. I'd like to replace
I would like to run a str_replace or preg_replace which looks for certain words
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported

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.