if after trying all above sugestion , if terminal doesnt work then you should update your windows 10 version to latest for example you windwos 10 version might be at 1709 but now update to latest to 22H2.
what is did is i have installed fresh windows 10 and installed andorid studio meerkat feature drop , is shocked to see that my terminal was not working. i checked java home in enviroment settings, checked for terminal settings in android studio set the directory to cmd.exe , also set the use legacy in cmd, run android studio as administrator. i was fed up with all the solution which was all write but wasint working for me. after some time i was trying to install whatsapp latest version to windows , but was getting error, then i thaught, this might be the same reason my android studio not working well. then http://microsoft.com/en-us/software-download/windows10 i used this link to update my pc. it took some time to update. and when i reopened android studio terminal is working well !. and now iam able to install whatsapp too. great enjoy.