简体   繁体   中英

How to execute multiple commands from a batch file, in windows command prompt, while keeping the command prompt context open?

I want to create a batch file that would execute two commands one after the other, and then keep the CMD window open. The following is what I tried, after some searching on the internet, but only the first command is getting executed. What am I missing?

cmd /k C:\Users\Hp\yolo\test1\.env1\Scripts\activate && cd C:\Users\Hp\yolo\test2

I also tried with just one '&' instead of two, but that doesn't work either. Only the first command gets executed in both cases.

doskey /macrofile=%~dp0adb_macros.txt 

color 9F 

cmd /K 

For those who came here for an example of an actual answer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM