1

I have a ConEmu macro for Ctrl+T which runs Task("Powershell"). My Powershell task just runs powershell with the argument \dir %userprofile%.

The Macro tab in "About ConEmu" says that the Task command can take a second argument for the directory:

Task("Name"[,"Dir"])
- start task with specified name

I'd like to make my macro open a new tab with the same working directory as the tab I'm looking at when I hit Ctrl+T. Is this possible?

1 Answer 1

1

When you "CD" in powershell, it does not actually change current process directory (SetCurrentDirectory is not called). You may check this with ProcessExplorer for example.

So, you may run from your active powershell prompt

PowerShell -new_console

or do that with GuiMacro. Using GuiMacro you can set any desired hotkey for that action.

Print("\ePowerShell -new_console\n")

In theory, you may create new tab without using active powershell prompt, there is another macro, but you need to force your PowerShell to call SetCurrentDirectory explicitly. For example, you may override your prompt function in powershell profile.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .