0

I tried using the accepted answer in this post, but it isn't working. Also, how would I add params? I'm using virtualenv and trying to activate that environment and then run my script.

Current Batch File - Does not execute last line

cd\
cd c:\mydir\scripts\
activate.bat
c:\mydir\scripts\python.exe c:\mydir\scripts\myscript.py %*

Desired batch file with params - Script accepts a 2D array

cd\
cd c:\mydir\scripts\
activate.bat
c:\mydir\scripts\python.exe c:\mydir\scripts\myscript.py [[p1,p2,p3,p4],[p1,p2,p3,p4]]

1 Answer 1

2

Batch files are funny. If you execute a batch file from within another batch file by just specifying the batch file name, as you would from the command line, the first batch file gets terminated. To prevent this, CALL the second batch file from the first - in your example batch file (specifically, the desired one), change the line that reads

activate.bat

to read

call activate.bat

and you should be OK.

Sign up to request clarification or add additional context in comments.

1 Comment

Worked perfect! Wish I could give you a thousand up votes for this lol. It's been driving me crazy for days.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.