Lukap
Lukap

Reputation: 31963

Windows command prompt start from certain directory

I have a .bat file

and in the file something like this

d:
cd Doc
cd bestFolder

The problem is when I start the bat file with double click the console is prompted but in just few moments it is gone :(

How can I make a bat file that will start the command promt at some specific directory ?

NOTE: I want to be able to input commands after the console is show I do not want the console to be hidden in just few moments

Upvotes: 3

Views: 596

Answers (2)

Anirudh Ramanathan
Anirudh Ramanathan

Reputation: 46728

Put this line cmd at the end of your batch file.

@echo off    
d:
cd Doc
cd bestFolder
REM <any other commands you want to run>
cmd

That will execute the commands and prevent your command window closing.

Upvotes: 1

Nikos C.
Nikos C.

Reputation: 51832

You do that by creating a shortcut to cmd.exe and editing the properties of the shortcut. One of the properties deals with the initial current directory.

Upvotes: 0

Related Questions