Reputation: 363
I am trying to write a batch script to push folder using Android ADB.
The commands I am trying to achieve is :
c:\adbpush.bat d:\Android\XDA\Bootlogo
How do I get the string Bootlogo ?
I want to do something like this
@echo off
c:
cd \adb
adb push d:\Android\XDA\Bootlogo /sdcard/Bootlogo
Looks simple but I don't have any idea how to get string Bootlogo
From d:\Android\XDA\Bootlogo
I hope you guys understand. Thanks A Lot.
Upvotes: 0
Views: 1361
Reputation: 7046
Alternatively you could get it from batch file via powershell split-path -Leaf function.
Command
c:\adbpush.bat d:\Android\XDA\Bootlogo
adbpush.bat
@ECHO OFF
start /b powershell -command "$a = Split-Path -Leaf -Path %1;Write-Host $a"
PAUSE
Result
Bootlogo
Upvotes: 0
Reputation: 41244
Given your command line
c:\adbpush.bat d:\Android\XDA\Bootlogo
Then this should work for you:
::adbpush.bat
@echo off
cd /d "c:\adb"
adb push %~1 \sdcard\%~nx1
Upvotes: 0
Reputation: 80113
for /f "delims=" %%a in ("%~1") do set yourstring=%%~nxa
echo %yourstring%
shoud get that info for you.
Upvotes: 1