How to run a command on command prompt startup in Windows
cmd, command, command-prompt, windows
Solution
I found my answer: I should use the `/K` switch, using which I can enter a new command on the opened command prompt.
E.g. `cmd /K cls` will open a command prompt for me and clear it. (Answer for question 1)
and
`cmd /K MyBatchFile.bat` will start a command prompt, execute the batch file and stay on the command prompt and will not exit. (Answer for question 2).
Problem
EDIT If you want to perform any task at computer startup or based on an event this is very helpful http://answers.microsoft.com/en-us/windows/forum/windows_7-performance/how-to-schedule-computer-to-shut-down-at-a-certain/800ed207-f630-480d-8c92-dff2313c193b Back to the question I have two questions: I want some specific commands to be executed when I start command prompt. e.g. `cls` to clear my command prompt. I want to execute some commands in a batch file and wait for the user to enter new commands (if any). e.g. A batch file which will take the user to some specified folder and then wait for the user to rename/delete a file from the command prompt. How can I do it?