Macro to change directory in Far command prompt

You want to talk about Far Manager, but don't know where to turn?
Post Reply
old_gregg
Posts: 14
Joined: Fri 01 May, 2015 16:04
Has thanked: 1 time
Been thanked: 1 time

Macro to change directory in Far command prompt

Post by old_gregg » Tue 26 Dec, 2017 16:05

How do I create a command to change directories in the Far Manager command prompt?

It seems that the commands in the Far command prompt are being run in a subshell, so directory changes have no effect.

I can use doskey macros to create aliases, but then I would have to run doskey manually to install the macros every time I start Far.

I know there are the Ctrl+# hotkeys, but I don't want to have to hit Ctrl+O, Ctrl+#, Ctrl+O when I'm working in the command prompt.

Is there a way to run a batch script when Far starts? Or, is there a way to define a DOS command to change directories with a Far macro or something that wouldn't involve activating the panel and using a hotkey?

User avatar
HaRT
Moderator
Posts: 8645
Joined: Tue 30 Aug, 2005 17:21
Location: Санкт-Петербург
Has thanked: 78 times
Been thanked: 142 times

Macro to change directory in Far command prompt

Post by HaRT » Tue 26 Dec, 2017 16:32

old_gregg wrote:
Tue 26 Dec, 2017 16:05
It seems that the commands in the Far command prompt are being run in a subshell
Far has a number of internal commands which are run by Far itself directly. CD is one of these commands.
old_gregg wrote:
Tue 26 Dec, 2017 16:05
I would have to run doskey manually to install the macros every time I start Far.
There are ways to start it automatically. Search for doskey in the Russian-language part of the forum.
old_gregg wrote:
Tue 26 Dec, 2017 16:05
I don't want to have to hit Ctrl+O, Ctrl+#, Ctrl+O
You can record these sequences as key macros.

What are the scenarios you'd like to cover with such commands?
Фар есть инструмент, а не нянька. © 2009 DrKnS

old_gregg
Posts: 14
Joined: Fri 01 May, 2015 16:04
Has thanked: 1 time
Been thanked: 1 time

Macro to change directory in Far command prompt

Post by old_gregg » Tue 26 Dec, 2017 17:14

Oh it's really no big deal. I was just trying to emulate my bash stuff in the Windows command prompt to be consistent. I have a bunch of bash functions that cd to various places, but it's really not a very good solution to begin with. Far takes care of most of the problems cd'ing around, I should just use it as intended. I just thought setting up a few commands would be easy, but I've been trying to figure this out for a couple hours now. I think I should probably give up.

User avatar
HaRT
Moderator
Posts: 8645
Joined: Tue 30 Aug, 2005 17:21
Location: Санкт-Петербург
Has thanked: 78 times
Been thanked: 142 times

Macro to change directory in Far command prompt

Post by HaRT » Wed 27 Dec, 2017 00:58

old_gregg, my approach is to have 1-3 dirs assigned to folder shortcuts 0-9 for fastest access, and to navigate to other directories via folders history (filtering turned on by default using respective scripts). Other people use more techniques: extended folder shortcuts, additional items in disks menus, user sub-/menu/-s, calling plugins/scripts from command line, etc.
Фар есть инструмент, а не нянька. © 2009 DrKnS

old_gregg
Posts: 14
Joined: Fri 01 May, 2015 16:04
Has thanked: 1 time
Been thanked: 1 time

Macro to change directory in Far command prompt

Post by old_gregg » Thu 28 Dec, 2017 00:32

Since Far Manager handles the CD commands itself, can I hook into that mechanism and define my own commands that run macros? I've never used Far macros, so I'm not sure what they can do.

User avatar
John Doe
Бюрократ
Posts: 12192
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 31 times
Been thanked: 159 times

Macro to change directory in Far command prompt

Post by John Doe » Thu 28 Dec, 2017 10:28

Sure you can, using console aliases, as you intended in first post.

old_gregg
Posts: 14
Joined: Fri 01 May, 2015 16:04
Has thanked: 1 time
Been thanked: 1 time

Macro to change directory in Far command prompt

Post by old_gregg » Thu 28 Dec, 2017 15:29

Are there any docs that explain how to set up a console alias?

User avatar
John Doe
Бюрократ
Posts: 12192
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 31 times
Been thanked: 159 times

Macro to change directory in Far command prompt

Post by John Doe » Thu 28 Dec, 2017 22:47

Google "doskey", and/or google-translate some russian topics:
viewtopic.php?p=117329#p117329
viewtopic.php?f=60&t=8546

Post Reply

Return to “General Discussions”