Skip to content

Display and control your Android device

Document envvars for all platforms

Romain Vimonted84e18b1ae3
diff --git a/FAQ.md b/FAQ.md
index 0cebeeb7..f6a8f226 100644
--- a/FAQ.md
+++ b/FAQ.md
@@ -103,10 +103,23 @@ You could overwrite the `adb` binary in the other program, or ask _scrcpy_ to
use a specific `adb` binary, by setting the `ADB` environment variable:
```bash
+# in bash
export ADB=/path/to/your/adb
scrcpy
```
+```cmd
+:: in cmd
+set ADB=C:\path\to\your\adb.exe
+scrcpy
+```
+
+```powershell
+# in PowerShell
+$env:ADB = 'C:\path\to\your\adb.exe'
+scrcpy
+```
+
### Device disconnected
diff --git a/README.md b/README.md
index 20ad0f9c..db531c61 100644
--- a/README.md
+++ b/README.md
@@ -505,10 +505,23 @@ Suppose that this server is accessible at 192.168.1.2. Then, from another
terminal, run `scrcpy`:
```bash
+# in bash
export ADB_SERVER_SOCKET=tcp:192.168.1.2:5037
scrcpy --tunnel-host=192.168.1.2
```
+```cmd
+:: in cmd
+set ADB_SERVER_SOCKET=tcp:192.168.1.2:5037
+scrcpy --tunnel-host=192.168.1.2
+```
+
+```powershell
+# in PowerShell
+$env:ADB_SERVER_SOCKET = 'tcp:192.168.1.2:5037'
+scrcpy --tunnel-host=192.168.1.2
+```
+
By default, `scrcpy` uses the local port used for `adb forward` tunnel
establishment (typically `27183`, see `--port`). It is also possible to force a
different tunnel port (it may be useful in more complex situations, when more
@@ -542,10 +555,23 @@ ssh -CN -L5038:localhost:5037 -R27183:localhost:27183 your_remote_computer
From another terminal, run `scrcpy`:
```bash
+# in bash
export ADB_SERVER_SOCKET=tcp:localhost:5038
scrcpy
```
+```cmd
+:: in cmd
+set ADB_SERVER_SOCKET=tcp:localhost:5038
+scrcpy
+```
+
+```powershell
+# in PowerShell
+$env:ADB_SERVER_SOCKET = 'tcp:localhost:5038'
+scrcpy
+```
+
To avoid enabling remote port forwarding, you could force a forward connection
instead (notice the `-L` instead of `-R`):
@@ -559,10 +585,23 @@ ssh -CN -L5038:localhost:5037 -L27183:localhost:27183 your_remote_computer
From another terminal, run `scrcpy`:
```bash
+# in bash
export ADB_SERVER_SOCKET=tcp:localhost:5038
scrcpy --force-adb-forward
```
+```cmd
+:: in cmd
+set ADB_SERVER_SOCKET=tcp:localhost:5038
+scrcpy --force-adb-forward
+```
+
+```powershell
+# in PowerShell
+$env:ADB_SERVER_SOCKET = 'tcp:localhost:5038'
+scrcpy --force-adb-forward
+```
+
Like for wireless connections, it may be useful to reduce quality: