'cscript' is not recognized inside a batch
Asked Answered
C

3

4

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

Clannish answered 20/12, 2012 at 16:52 Comment(3)
It must be a typo or something. It works fine when I try it.Vilayet
Does it work if you replace cscript with "%SystemRoot%\System32\cscript.exe"?Winner
Did not work, searching in the web found the link in my answer.Clannish
C
4

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

I solve it with this

Clannish answered 21/12, 2012 at 14:16 Comment(0)
S
4

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

Sc answered 22/6, 2017 at 6:4 Comment(0)
A
0

Be sure you have cscript.exe in System32 folder.

Then click on environment variables button in Control Panel -> System -> advanced tab and add environment variable PATH with C:\Windows\System32 as value.

If you have already a PATH variable just add the same value with a semicolon: ;C:\Windows\System32.

Antonyantonym answered 27/5, 2021 at 8:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.