I am calling a .bat file as a Visual Studio pre-build event. In Visual Studio, project > properties > build events > pre-build events, I have the following call:
cmd /c ""C:\Program Files (x86)\MyBatchFile.bat""
The .bat script runs fine until it reaches a line that calls a Python script (from inside the .bat file). Then the console repeatedly outputs an error: 'Could not decode the provided text'.
The line in the .bat file that triggers the error is shown here (bottom line):
echo Setting Plugin Type...
set PluginType=--source
echo Setting Project Name...
set ProjectName=-n Name
echo Setting display name...
set DisplayName=
echo Setting author...
set Author=-a Author
echo Setting description...
set Description=-d "Description"
echo Setting 'no-prompt' for confirming new plugin setup...
set Confirm=--no-prompt
python "C:\Program Files (x86)\wp.py" new %PluginType% %ProjectName% %DisplayName% %Author% %Description% %Confirm%
I have tried modifying the .bat file so that the word 'python' is on one line, and the next line calls the python script, like this:
python
"C:\Program Files (x86)\wp.py" new %PluginType% %ProjectName% %DisplayName% %Author% %Description% %Confirm%
This prevents the error from outputting, but the console instead says 'python not found'. I have Python in my environment variables, and it works fine when I open a command line and type 'python'. The .bat file also works fine when I double click it in file explorer to run it.
I can't figure out why when Visual Studio calls my .bat file it cannot detect python installed on my machine.
Any ideas how to fix this?