0

First thing first, i don't write cmd programs usually, so that's why i'm asking for this very basic question.

My problem is: I have a .bat file that list some actions, all of them works fine, except for one. This is the code, so that it will be easier to explain:

ECHO OFF
CLS
cd C:\Android\adk\sdk\platform-tools
adb devices
:MENU
ECHO.
ECHO ************************************
ECHO Select what to do next:
ECHO ************************************
ECHO.
ECHO 1 - Check devices status
ECHO 2 - Disable auto update for this device
ECHO 3 - Enable auto update for this device
ECHO 4 - Install app.apk
ECHO 5 - Other actions
ECHO 6 - Close
ECHO.
SET /P M=Type 1, 2, 3, 4 or 5 then press ENTER:
IF %M%==1 GOTO CHECKDEV
IF %M%==2 GOTO DISABLEUPD
IF %M%==3 GOTO ENABLEUPD
IF %M%==4 GOTO INSTALLAPP
IF %M%==5 GOTO OTHER
IF %M%==6 GOTO EOF
:CHECKDEV
adb devices -l
GOTO MENU
:DISABLEUPD
adb pull /system/app/SystemUpdater.apk C:\Android\QuickCommands\autoUpdateBackup
adb remount
adb shell rm /system/app/SystemUpdater.apk 
GOTO MENU
:ENABLEUPD
ECHO. Currently it doesn't work. :(
GOTO MENU
:INSTALLAPP
adb install C:\src\heatgeniusapp\release\android\app.apk
GOTO MENU
:OTHER
set todir=C:\Android\adk\sdk\platform-tools

What I want is that when you press 5 (GOTO OTHER), the cmd will be at this address:

C:\Android\adk\sdk\platform-tools

And ready to write some custom command and execture them as normal.. how can i achieve this?

Thanks in advance, have a good day

Nick
  • 10,791
  • 6
  • 40
  • 82
  • possible duplicate of [How to keep cmd running after opening a .bat file script](http://stackoverflow.com/questions/15012344/how-to-keep-cmd-running-after-opening-a-bat-file-script) – MichaelS Jan 23 '15 at 10:25

1 Answers1

2

Put cmd /k on the very last line of the script. CD yourpath will "bring" your cmd to the desired directory. And use the search function next time ;-)

...
:OTHER
CD /D C:\Android\adk\sdk\platform-tools
CMD /K

You can skip /D if you are sure that your bat file is on the same drive as the target folder (C:\Android\adk\sdk\platform-tools), means both are on C: I would still keep /D

MichaelS
  • 5,569
  • 5
  • 28
  • 42