Open application with hidden cmd.exe

寵の児 提交于 2019-12-11 02:12:42

问题


To open an Android Virtual Device, I was recommended to add a shortcut or a batch file with the next line:

C:\android-sdk\tools\emulator.exe -avd MyAVD

Nevertheless, when I do so, this opens with a command line window, which if I close by error (Something frequently since I work with many command line windows for debugging the apps), It also closes the AVD emulator.

I want to open the AVD without the command line window, to prevent this, I was recommended to do so with cmd /c or with start at the beginning, but it isn't working either. Anyone can tell me how should I do this?


回答1:


You can use a VBScript to open the command prompt window hidden

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run("C:\batchfile.bat"), 0, True

If you save that as .vbs and make sure to replace C:\batchfile.bat with the location of yours, this will run the command hidden.




回答2:


This should do it, it should run as a subprocess of taskeng.exe in Task Manager.

schtasks -create -tn foo -tr <command> -sc once -st 00:00 -ru system
schtasks -run -tn foo
schtasks -delete -tn foo -f

ref



来源:https://stackoverflow.com/questions/14390396/open-application-with-hidden-cmd-exe

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!