'cscript' is not recognized inside a batch

2019-08-12 19:09发布

问题:

I need to call a .bat that calls a .vbs. When i run FindDir.vbs from command prompt is ok, but when i try to call it from CallingVbs.bat i got the error message.

'cscript' is not recognized as an internal or external command.

The code i'm using to call .vbs is the same to .bat and to command prompt.

cscript FindDir.vbs

Both files are in same folder. I do not understand why cscript command works in command prompt but not in .bat. Could anyone explain me why it happens?

Thanks

回答1:

By mistake i was using a variable with name "path", so cscript stopped working.

I solve it with this



回答2:

Very simply you solve this issue. but before that you must ensure the cscript.exe file exist in your C:\Windows\System32 path. then,

%SystemRoot%\System32\then your command line