How to start powershell with a window title?

Question:

I have a batch file that allows me to go to particular folder based on my input.

At the end of execution, a command prompt window with the title “bits” opens up and is in the specified directory corresponding to the input choice. This is all good. But I want to have the same thing done with Powershell.

If, instead of start "bits", I put, start powershell, in the last line, I can get Powershell console to open. By doing this, I have two issues.

  1. Powershell console is still in d:\test\bits folder and not in the one I intended it to go.
  2. I cannot get the title to be bits

How do I get the functionality I want with Powershell?

Answer:

From what I expected and what I was able to reproduce with your script, the current directory is set to the intended one (d:\test\bits\code\pl if I enter 1)

For the title part, you can do the following:

Source:

How to start powershell with a window title? by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply