- 1 year ago
Unable to get an ADB shell command with a path working within a Windows shell
Comment
1 / 1
To execute an ADB shell command with a path in a Windows shell, you need to properly escape the path and handle spaces in the path. Here's how you can do it:
- Use double quotes (
"
) around the path to handle spaces:
bashadb shell "ls \"/mnt/sdcard/My Folder\""
In this example, the path /mnt/sdcard/My Folder
contains spaces, so we wrap it with double quotes to ensure it is treated as a single argument.
- If the path contains double quotes, you can escape them with a backslash (
\
):
bashadb shell "ls \"C:\\My Folder\\With \"Quotes\"\""
In this example, the path C:\My Folder\With "Quotes"
contains double quotes, so we escape them with a backslash.
- If you need to use a single backslash in the path, you need to escape it with another backslash:
bashadb shell "ls \"C:\\My Folder\\With Backslash\\\""
In this example, the path C:\My Folder\With Backslash\
contains a backslash, so we escape it with another backslash.
Make sure to adjust the path and the ADB shell command as per your specific requirements. If you encounter any specific issues or errors, please provide more details, and I'll be happy to assist further.