为简便起见,我尝试将两个.bat文件合并为一个,因此只剩下一个.bat文件。我的第一个是(one.bat):
--a lot of code here --
switch.bat "matlab"
exit
第二个用于切换到另一个应用程序(switch.bat):
@if (@a==@a) @end /*
cscript //E:JScript //nologo "%~f0" %*
REM --- Insert other batch codes here ---
exit /b
*/
// --- JScript codes below this line ----
var WshShell = WScript.CreateObject("WScript.Shell");
var ARGS = WScript.Arguments;
WshShell.AppActivate(ARGS.Item(0));
WshShell.SendKeys("~");
WScript.Echo(ARGS.Item(0) + " activated");
WScript.Quit(0);