scrcpy icon indicating copy to clipboard operation
scrcpy copied to clipboard

Cannot access scrcpy *universally*, even after setting the PATH

Open swingcake opened this issue 8 years ago • 9 comments

scrcpy doesn't run from anywhere outside of where it is located in Windows 10. I've set the PATH, so the command gets recognized but does nothing.

screenshot 61 screenshot 62 screenshot 64

swingcake avatar Mar 30 '18 12:03 swingcake

Please check the output of the command when it does not work.

rom1v avatar Mar 30 '18 12:03 rom1v

I installed MSYS2, but since I have never used it before I'm not certain as to what I am doing wrong here.

screenshot 66

swingcake avatar Mar 30 '18 14:03 swingcake

Run:

 ./scrcpy

rom1v avatar Mar 30 '18 15:03 rom1v

Yep. Same issue. No output.

screenshot 67

swingcake avatar Mar 30 '18 16:03 swingcake

Ah sorry, I didn't remember what the problem was (I confused with another question).

MSYS2 will not help here, since it will not check the same PATH.

EDIT: did you restart cmd.exe after you added the variable in PATH?

Maybe you could create a script run-scrcpy.cmd in the scrcpy directory:

scrcpy >stdout 2>stderr

Then execute from somewhere else (from cmd.exe):

run-scrcpy

Then read the stdout and stderr files.

rom1v avatar Mar 30 '18 16:03 rom1v

Ah, you are using PowerShell. What if you use cmd.exe instead?

rom1v avatar Mar 30 '18 17:03 rom1v

So I created run-scrcpy.cmd in the same directory where scrcpy.exe is located.

  • When I ran the command run-scrcpy from within the same directory, it ran perfectly and created 2 files stdout and stderr.

    • stderr: INFO: Initial texture: 1080x1920

    • stdout is empty.

  • But when I run the same command from any other directory, I get the usual output from the CLI which is scrcpy 1>stdout 2>stderr. However, scrcpy doesn't run. The outputs of stderr and stdout are as follows.

    • stderr: ERROR: "adb push" returned with value 1

    • stdout is empty.

EDIT: Same results with cmd.exe

screenshot 68

swingcake avatar Mar 30 '18 17:03 swingcake

Ah, I think I get it.

The prebuilt windows is a "portable" version (scrcpy-server.jar is not located in a predefined absolute path, cf Makefile).

In this version, it just executes adb push scrcpy-server.jar, so it expects it to be in the current directory.

To confirm, please try to copy scrcpy-server.jar to the directory you execute scrcpy.exe.

EDIT: Or execute/make a cmd script:

set SCRCPY_SERVER_PATH=…
scrcpy

rom1v avatar Mar 30 '18 17:03 rom1v

You're right. Works!

swingcake avatar Mar 30 '18 17:03 swingcake