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

scrcpy-noconsole as command line option #2167

Open
1 task done
efelon opened this issue Mar 3, 2021 · 7 comments
Open
1 task done

scrcpy-noconsole as command line option #2167

efelon opened this issue Mar 3, 2021 · 7 comments

Comments

@efelon
Copy link

efelon commented Mar 3, 2021

Is your feature request related to a problem? Please describe.

I want to point out that scrcpy-noconsole.vbs, which is already merged #1988, will be blocked in many corporate environments. Leaving those user with no option to start the application without console.

Describe the solution you'd like

It would be really great to have a command line option "--noconsole" for the scrcpy.exe itself. Then we only would need one additional batch file scrcpy-noconsole.bat using this option. Or even turn the logic around and start scrcpy.exe always without console and add an option "--console".

Describe alternatives you've considered

I have looked for other ways in Windows batch to hide the console which doesn't seam to be possible. You always need third party application like https://ritchielawrence.github.io/cmdow/ which also get blocked by corporate security tools.

@rom1v
Copy link
Collaborator

rom1v commented Mar 3, 2021

It would be really great to have a command line option "--noconsole" for the scrcpy.exe itself

This is not possible: #1988 (comment)

Then we only would need one additional batch file scrcpy-noconsole.bat using this option

As soon as you run a .bat, it will open a console (possibly closing it immediately).

Or even turn the logic around and start scrcpy.exe always without console and add an option "--console".

That does not work either. If run from a console, scrcpy.exe must be blocking and output to stdout/stderr.

You always need third party application like https://ritchielawrence.github.io/cmdow/ which also get blocked by corporate security tools.

Yes, the minimal "third party tool" I found was using a vbs script.

An alternative would be to compile a separate .exe (scrcpy-noconsole.exe, like before), but which would just execute scrcpy.exe with the correct flags. But this is far more complex to handle that the tiny .vbs script.

@efelon
Copy link
Author

efelon commented Mar 4, 2021

I get it, thanks for the explanation. I already assumed problems with the implementation and I'm not familiar with the particularities in windows. I assumed one could just redirect every output to a internal "terminal" which can be shown on demand.

Mainly I wanted to point out, that the vbs script is getting blocked by, at least some, security tools. If you want to close this issue, it's fine with me. This additional cmd windows is not such a big deal, just cosmetics.

@steff75
Copy link

steff75 commented Mar 22, 2021

Among other things, I have also blocked VBS scripts on my PC.
My solution is also a 3rd party tool: I use "nircmd" with the "execmd" parameter as a workaround.

nircmd execmd scrcpy.exe [...]

@Dhyfer1
Copy link

Dhyfer1 commented Jan 19, 2022

Among other things, I have also blocked VBS scripts on my PC.
My solution is also a 3rd party tool: I use "nircmd" with the "execmd" parameter as a workaround.

nircmd execmd scrcpy.exe [...]

@steff75 Hi. The parameter that you indicate, how can I use it inside a .bat file so that it's executed at system startup?

@steff75
Copy link

steff75 commented Jan 20, 2022

@Dhyfer1 I'm not quite sure if this is what you mean but I have it like this in a bat file:
adb connect 192.168.178.57:5555
nircmd execmd scrcpy.exe --serial 192.168.178.57:5555 -Sw -m 1024 -b 5M
The nircmd.exe must be in the Windows folder, otherwise you need the full path.
For the autostart you can use the task scheduler.

@Dhyfer1
Copy link

Dhyfer1 commented Feb 3, 2022

@steff75 hello. With the commands in your bat file:

adb connect 192.168.178.57:5555
nircmd execmd scrcpy.exe --serial 192.168.178.57:5555 -Sw -m 1024 -b 5M

I see that you use scrcpy to connect wirelessly to your phone, but first you have to plug it into your PC for your bat file to work, right?

For the autostart you can use the task scheduler.

In another issue in this repository I learned how to configure the task scheduler so that scrcpy starts automatically when the device is plugged in, and I discovered that there is a tool called autoadb from the same developer to achieve the same purpose. But what I need to know is how to use autoadb to start scrcpy automatically every time I plug in my phone and without using the task scheduler? Is it possible? I can start scrcpy with autoadb manually from the command line, but I don't know how to make autoadb run automatically.

@steff75
Copy link

steff75 commented Feb 4, 2022

but first you have to plug it into your PC for your bat file to work, right?

Yes, connect the device over USB, then run:
scrcpy --tcpip

But what I need to know is how to use autoadb to start scrcpy automatically every time I plug in my phone and without using the task scheduler?

Unfortunately I can't help you there, because I haven't dealt with autoadb yet. I currently use scrcpy only wireless with desktop shortcuts. I just have to connect the smartphone again via USB after a reboot and repeat the above command.

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

4 participants