Issue
I want to create a shortcut to run AVD emulator without opening Android Studio. So I use a .bat
file which contains next line:
emulator @Pixel_2_API_29
When running it I, of course, get a console window, which I really don't need:
If I close it, emulator also closes. Is there any way to run it in background or something similar just to get a running emulator without any console windows (the same behaviour can be achieved if you run emulator from Android Studio and close it immideately)?
Solution
This is a hybrid cmd/js/vbs/batch and this code can do this job for you, just save as .cmd and enjoy!
<!-- :
@echo off && mode 050,03 && title <nul && title .\%~nx0 && for /f ^tokens^=* %%i in ('
%__APPDIR__%wScript.exe "%~dpnx0?.wsf" @Pixel_2_API_29 ^& cls ') do exit /b 2>nul >nul
--> <job> <script language = "vbscript"> Set WshShell =CreateObject( "WScript.Shell" )
WshShell.Run chr(34)&"%userprofile%\AppData\Local\Android\Sdk\emulator\emulator.exe"&_
Chr(34)&WScript.Arguments(0)&Chr(34), 0, False: Set WshShell = Nothing </script></job>
- Obs.:
You can read more about hybrid bat
in this link
, and see somesample code/files here.
- For using with arguments, just add quote in for loop bat session:
"arg1 arg2 ag3" <==> " -memory 4096" obs.: 3rd line in code!
<!-- :
@echo off && mode 050,03 && title <nul && title .\%~nx0 && for /f ^tokens^=* %%i in ('
%__APPDIR__%wScript.exe "%~dpnx0?.wsf" @Pixel_2_API_29 " -memory 4096"^>nul')do exit/b
--> <job> <script language = "vbscript"> Set WshShell =CreateObject( "WScript.Shell" )
WshShell.Run chr(34)&"%userprofile%\AppData\Local\Android\Sdk\emulator\emulator.exe"&_
Chr(34)&WScript.Arguments(0)&Chr(34)&Chr(34)&WScript.Arguments(1)&Chr(34), 0, False:
Set WshShell=Nothing</script></job>
Answered By - Io-oI
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.