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]]
Eric
  • 489
  • 5
  • 16

1 Answers1

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.

Jeff Zeitlin
  • 9,773
  • 2
  • 21
  • 33
  • Worked perfect! Wish I could give you a thousand up votes for this lol. It's been driving me crazy for days. – Eric Aug 23 '17 at 14:25