troubleshooting Question

Python - credentials in a .bat file

Avatar of csehz
csehzFlag for Hungary asked on
Windows OSPython
2 Comments2 Solutions217 ViewsLast Modified:
Dear Experts,

I would need to create a .bat file under Windows, which is able to:

1) run a .py so Python file and
2) also containing credentials as the Python code needs to connect to SQL and download data.

Could you please advise about the syntax how such .bat file should look like concretely?

Actually having the following try but it does not work (it executes the Python code but not asking for the password for the user):

@echo off
runas /netonly /user:smea\csehz
"C:\Python27\python.exe" "C:\Users\csehz\Desktop\HelloWorld.py"
pause

Thanks in advance,
SOLUTION
David Favor
Fractional CTO
Join our community to see this answer!
Unlock 2 Answers and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros