Page 1 of 1

Problem executing a batch file via Python

Published: July 15, 2019 - 3:57 PM
by Patrice_minagri
Good morning,

I am trying to run a batch file via a wapt package.

So I write

Code: Select all

run('fichier.bat') ou run(r'fichier.bat') 
In return I get an error stating: "fichier.bat is not recognized as an internal\r\nor external command, executable program or batch file.\r\n"

The 'fichier.bat' file is in the root of the package.

I've done this successfully before. So I'm wondering about this mistake.

Does anyone have any ideas?

THANKS

Re: Problem executing a batch file via Python

Published: July 19, 2019 - 6:56 PM
by dcardon
Hello Patrice,
Patrice_minagri wrote: July 15, 2019 - 3:57 PM I am trying to run a batch file via a wapt package.

So I write

Code: Select all

run('fichier.bat') ou run(r'fichier.bat') 
In return I get an error stating: "fichier.bat is not recognized as an internal\r\nor external command, executable program or batch file.\r\n"

The 'fichier.bat' file is in the root of the package.

I've done this successfully before. So I'm wondering about this mistake.

Does anyone have any ideas?
Yes, that should work... It must be related to the Windows machine configuration, maybe a GPO that's disabling the automatic association of .bat files... You can try the following command:
run('START /wait "MyScript" CMD /c file.bat')
The best option is still to convert it to Python! :-)

Sincerely,

Denis

Re: Problem executing a batch file via Python

Published: August 5, 2019 - 09:05
by Patrice_minagri
Hi Denis,

Thanks for your reply. I'll look into it.

Yes, I know it would be better in Python. Let's just say I still have some gaps in my knowledge on the subject ;)

. Best regards,

Patrice