If I run my bat file, it runs on system's cmd.exe. I want my batch script to use my version of cmd.exe and not the defualt one which is under C:\Windows\System32 (which might be tampered by the bad guy on a compromised machine)
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Open C:\Windows\System32\cmd.exe
. In command prompt run the below command (In other words, invoke your version of cmd.exe
providing it the *.bat
as argument or command to run)
Folder:\path\your_version_cmd.exe folder:\path\your_bat_file.bat
回答2:
I wrote another script to run my script (mybat.bat) from my version of cmd (mycmd.exe). I kept both the cmd.exe and mybat.bat in the same folder. I called this new script as 'runmybat.bat' and inside it I code: cd /d %~dp0 start mycmd.exe /c mybat.bat
. Running this runmybat.bat will run mybat.bat under mycmd.exe -- task accomplished!!