Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
111.29k stars 10.67k forks source link

Need a parameter to launch scrcpy without console #2017

Open Mogez opened 3 years ago

Mogez commented 3 years ago

VBS works but how about add a command line switch? It'll be clean and clear.

Thanks a lot for your work!

rom1v commented 3 years ago

That would be great, but that's not possible in the scrcpy executable itself: the fact that there is a console or no console is determined before running the executable.

Mogez commented 3 years ago

That would be great, but that's not possible in the scrcpy executable itself: the fact that there is a console or no console is determined before running the executable.

I see. I wish I could make a scrcpy-noconsole.exe like the previous versions...

rom1v commented 3 years ago

You could probably modify scrcpy-noconsole.vbs to forward the command-line arguments, so scrcpy-noconsole.vbs would behave the same way as the old scrcpy-noconsole.exe.

Mogez commented 3 years ago

Yeah, I finally made a legacy VB6 starter app to pass it on, it can be added to batch file in one line like this:

adb connect 192.168.1.24:5555 starter scrcpy.exe --noconsole --disable-screensaver --max-fps 60 -m 1440 --push-target "/sdcard/download/" --shortcut-mod lctrl -S -w --window-title "Android Rocks!" -s 192.168.1.24:5555

rom1v commented 3 years ago

scrcpy.exe --noconsole ...

What does it do? Please show the diff.

livingator commented 3 years ago

You could probably modify scrcpy-noconsole.vbs to forward the command-line arguments, so scrcpy-noconsole.vbs would behave the same way as the old scrcpy-noconsole.exe.

can i know how to do it? i prefer not to have console opened usually if it's possible

nevermind, figured out how to do it

chavocarlos commented 3 years ago

You could probably modify scrcpy-noconsole.vbs to forward the command-line arguments, so scrcpy-noconsole.vbs would behave the same way as the old scrcpy-noconsole.exe.

~can i know how to do it? i prefer not to have console opened usually if it's possible~

nevermind, figured out how to do it

Can you share with us, please?

livingator commented 3 years ago

You could probably modify scrcpy-noconsole.vbs to forward the command-line arguments, so scrcpy-noconsole.vbs would behave the same way as the old scrcpy-noconsole.exe.

~can i know how to do it? i prefer not to have console opened usually if it's possible~ nevermind, figured out how to do it

Can you share with us, please?

edit the .vbs file with notepad or anything you prefer and add your arguments after scrcpy.exe and before the end of double quotation. below is my.vbs for example CreateObject("Wscript.Shell").Run "cmd /c scrcpy.exe --stay-awake --render-driver=opengl --shortcut-mod=rctrl", 0, false hope it helps

chavocarlos commented 3 years ago

You could probably modify scrcpy-noconsole.vbs to forward the command-line arguments, so scrcpy-noconsole.vbs would behave the same way as the old scrcpy-noconsole.exe.

~can i know how to do it? i prefer not to have console opened usually if it's possible~ nevermind, figured out how to do it

Can you share with us, please?

edit the .vbs file with notepad or anything you prefer and add your arguments after scrcpy.exe and before the end of double quotation. below is my.vbs for example CreateObject("Wscript.Shell").Run "cmd /c scrcpy.exe --stay-awake --render-driver=opengl --shortcut-mod=rctrl", 0, false hope it helps

I swear that already did it, but think I did some mistake, now works. Thanks a lot.

luronumen commented 3 years ago

scrcpy-noconsole.vbs must supports parameters because if multiples devices are connected with the PC we have to identify what device we want to connect by --serial parameter otherwise nothing happen when run scrcpy-noconsole.vbs.

rom1v commented 3 years ago

https://github.com/Genymobile/scrcpy/pull/2052#issuecomment-765562412

luronumen commented 3 years ago

Thanks @rom1v

BlueStarBRS commented 7 months ago

i still want --noconsole and not a god damm ugly vbs that i cant pin to my start menu im sick of convert my vbs scripts into exe files who are over and over get delted by antivirus for nothing for real ngl

alphacorp-fr commented 6 months ago

Hello everyone, I'm not sure if this is still relevant, but if you're still looking, add these lines at the beginning of the .bat file to automatically minimize the console window after launching.

@echo off if not "%minimized%"=="" goto :minimized set minimized=true start /min cmd /C "%~dpnx0" exit :minimized

Lopou94 commented 2 months ago

Hello everyone, I'm not sure if this is still relevant, but if you're still looking, add these lines at the beginning of the .bat file to automatically minimize the console window after launching.

@echo off if not "%minimized%"=="" goto :minimized set minimized=true start /min cmd /C "%~dpnx0" exit :minimized

Hello

I followed your instructions and used the commands in the bat file but I still have 2 windows open.

The console windows will open behind the main scrcpy window even though I run the commands in bat

Any ideas?? 2024-08-12 19_33_07-pythonProject – ADBD py

image

Thanks in advance,

rom1v commented 2 months ago

Une scrcpy-noconsole.vbs if you don't want a console on Windows.

Lopou94 commented 2 months ago

Une scrcpy-noconsole.vbs if you don't want a console on Windows.

Yeah i found this file later on the folder.

I'm trying to run from python but I'm getting some errors

Thanks,

rom1v commented 2 months ago

If you run from python, don't use the .bat or .vbs, just exec scrcpy.exe with the arguments you want: https://stackoverflow.com/questions/89228/how-do-i-execute-a-program-or-call-a-system-command

Lopou94 commented 2 months ago

If you run from python, don't use the .bat or .vbs, just exec scrcpy.exe with the arguments you want: https://stackoverflow.com/questions/89228/how-do-i-execute-a-program-or-call-a-system-command

Yeah, i found the link that you sent but every time i running scrcpy from my software a console window opens directly if connection with smartphone is successful.

Can i use the arguments from the vbs when i am running the scrcpy.exe from my code?

Thanks,