Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need a parameter to launch scrcpy without console #2017

Open
Mogez opened this issue Jan 6, 2021 · 19 comments
Open

Need a parameter to launch scrcpy without console #2017

Mogez opened this issue Jan 6, 2021 · 19 comments

Comments

@Mogez
Copy link

Mogez commented Jan 6, 2021

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

Thanks a lot for your work!

@rom1v
Copy link
Collaborator

rom1v commented Jan 6, 2021

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
Copy link
Author

Mogez commented Jan 6, 2021

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
Copy link
Collaborator

rom1v commented Jan 6, 2021

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
Copy link
Author

Mogez commented Jan 7, 2021

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
Copy link
Collaborator

rom1v commented Jan 7, 2021

scrcpy.exe --noconsole ...

What does it do? Please show the diff.

@livingator
Copy link

livingator commented Jan 9, 2021

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
Copy link

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
Copy link

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
Copy link

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
Copy link

luronumen commented Feb 10, 2021

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
Copy link
Collaborator

rom1v commented Feb 10, 2021

#2052 (comment)

@luronumen
Copy link

Thanks @rom1v

@BlueStarBRS
Copy link

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
Copy link

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
Copy link

Lopou94 commented Aug 12, 2024

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
Copy link
Collaborator

rom1v commented Aug 12, 2024

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

@Lopou94
Copy link

Lopou94 commented Aug 12, 2024

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
Copy link
Collaborator

rom1v commented Aug 12, 2024

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
Copy link

Lopou94 commented Aug 12, 2024

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,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants