Avatar of csehz
csehz
Flag for Hungary asked on

Python - credentials in a .bat file

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

Open in new window


Thanks in advance,
Windows OSPython

Avatar of undefined
Last Comment
csehz

8/22/2022 - Mon
SOLUTION
David Favor

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
csehz

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23