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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:53:24+00:00 2026-05-30T16:53:24+00:00

I want to create an exe from a python script that uses command line

  • 0

I want to create an exe from a python script that uses command line arguments (argv)
From what I’ve seen py2exe doesn’t support command-line-arguments

What can I do?

EDIT: I was using a GUI2Exe tool, so I just missed the Console flag, but the accepted answer is perfectly correct

  • 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-30T16:53:26+00:00Added an answer on May 30, 2026 at 4:53 pm
    setup(console=['hello.py'])
    

    I believe the line you want to use looks like this.

    I tested this with 2 files:

    hello.py

    import sys
    
    for arg in sys.argv:
        print arg
    print "Hello World!"
    

    And setup.py

    from distutils.core import setup
    import py2exe
    
    setup(console=['hello.py'])
    

    I ran these commands:

    python setup.py py2exe
    

    And then in the dist folder, I ran this:

    hello.exe foo bar
    

    Result:

    hello.exe
    foo
    bar
    Hello World!
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a Gameboy emulator which runs directly from the exe file,
I want to know simply how to create a batch file from .exe file?
I want to create a process which uses shutdown.exe to shut down the computer
I want to create a .NET assembly that can be accessed from unmanaged code
I want to associate the .exe file extension with a shell script that launches
I want to create an installer EXE with some specific properties: it should be
I want to create a function that performs a function passed by parameter on
I want to create a simple http proxy server that does some very basic
I have a Python script that I'd like to compile into a Windows executable.
I want to add QSplashScreen to PyQT4 application. It works fine from Python, but

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.