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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:28:13+00:00 2026-06-09T20:28:13+00:00

I use a program (on Windows), whose name I won’t disclose, that can be

  • 0

I use a program (on Windows), whose name I won’t disclose, that can be opened from the command line without going through any authentication. I’m trying to create some security to prevent others from accessing it this way.

I plan on replacing the built-in binary for this program with a batch file with a first line that points to my own authentication system (implemented in python, compiled to .exe with py2exe), and the second line to the command that opens the program.

My original plan was to have my script (auth.py) stop the batch file from executing the second line if authentication failed with something like this:

if not authenticated:
    print('Authentication failed')
    sys.exit(1)
else:
    print('Successfully authenticated!')

I had counted on sys.exit(1) to do this, and I didn’t bother testing it out until I was done developing the script. Now I realize that sys.exit only exits the python process.

I either need a way to stop the batch process FROM the python script, or a way for the batch to detect the exit code from auth.py (1 if failed, 0 if passed) and execute the other program only if the exit code is 0 from there.

If anyone could give me any suggestions or help of any sort, I would really appreciate it.
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-06-09T20:28:14+00:00Added an answer on June 9, 2026 at 8:28 pm

    Use subprocess to call the program on successful authentication. So your python script would launch the program, not a batch file.

    if not authenticated:
        print('Authentication failed')
        sys.exit(1)
    else:
        print('Successfully authenticated!')
        proc = subprocess.Popen([program])
    

    Please note, if the user has permission to start the program from within a python or batch script, nothing is stopping them from accessing it directly. This will prevent no one from accessing the program; save maybe the extreme un-technical.

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

Sidebar

Related Questions

I write program for Windows CE that should work with Serial ports. I use
I have an owner-drawn list control in my Windows program. I use CListCtrl::GetBkColor to
My program use UdpClient to try to receive 27 responses from 27 hosts. The
I use a program call php easy calendar. Into that, there is a lot
I have program that I want to test on clean Windows installation. For now
I have a program that heavily uses std::map . Under Windows, much more memory
The goal behind this question is to create a portable Windows script/program that would
I'm writing a program that needs to take input from an XBox 360 controller.
I'm developing a Python command line utility that potentially involves rather large queries against
I am trying to use MinGW to compile a C program under Windows XP.

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.