I'm trying to get my Python apps executed using only one .bat
file.
The code I have is:
powershell -c "& { $Args | % { pythonw $_ } } 'C:\Users\pc2\Dropbox\app1.py' 'C:\Users\pc2\Dropbox\app2.py' 'C:\Users\pc2\Dropbox\app3.py' 'C:\Users\pc2\Dropbox\app4.py' 'C:\Users\pc2\Dropbox\app5.py'"
pause
This should open in PowerShell all scripts, but when executed the bat file, the cmd window is opened and I get:
C:\Users\USER\Dropbox\Aplicaciones>powershell -c "& { $Args | \Users\pc2\Dropbox\Aplicaciones\OnlyBot\only.py' 'C:\Users\pc2\Dropbox\Aplicaciones\Linker2Bot\linker.py' 'C:\Users\pc2\Dropbox\Aplicaciones\Esmuybarato\barato.py' 'C:\Users\pc2\Dropbox\Aplicaciones\to2\to2.py' 'C:\Users\pc2\Dropbox\Aplicaciones\TrackerBOT\boxxon.py'"
Falta la cadena en el terminador: '. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString
I notice the pythonw $_
is missing when the batch is executed.
How can I solve this?
cmd.exe
which executes a PowerShell command interpreted bypowershell.exe
to run several Python scripts interpreted bypythonw.exe
. Why not writing a Python script which does all at once? Or why is a batch file used at all and not just a PowerShell script with file extension *.ps1? – Mofi