Reputation: 728
Ok, so I have this batch script and what I want to happen is that when you run the script it does some standard stuff like change the path and access files etc... but after it's done that it goes back to being a normal cmd prompt/terminal where I can type in commands at free will.
Can this be done (in either dos or bash)? Is there like an execute
command that I can put in an internal while loop or is there a command where when the scirpt ends it can go back to the normal cmd/terminal?
Upvotes: 0
Views: 296
Reputation: 728
Never mind, I got a good solution using this code: (for windows)
set /p command=CMD:
%command%
Upvotes: 0
Reputation: 425
In Dos / windows command prompt if you run the batch file from command line you will get the prompt back always by default. Just like running any other command in command prompt. Also in windows when the batch file execution is complete you can just put Cmd.exe when everything has finished running I.e at the end of the batch file. Hope this helps! E.g
@echo off
Echo running
.
.
.
Cmd.exe
Or even at the end
Echo %command% | Cmd.exe
Upvotes: 1
Reputation: 3175
Do you need a full bash prompt? Or would something like this be enough?
#!/bin/bash
echo -n "Enter cmd: "
read COMMAND
echo ${COMMAND} | bash
Also, in a script, you can just execute bash
and get a full prompt in the current environment.
Upvotes: 1