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: 46
Joined: Fri 01 May, 2015 16:04
Has thanked: 10 times
Been thanked: 1 time

Macro to change directory in Far command prompt

Post by old_gregg »

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: 10823
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 221 times
Been thanked: 358 times

Macro to change directory in Far command prompt

Post by HaRT »

old_gregg wrote: Tue 26 Dec, 2017 16:05It 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:05I 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:05I 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: 46
Joined: Fri 01 May, 2015 16:04
Has thanked: 10 times
Been thanked: 1 time

Macro to change directory in Far command prompt

Post by old_gregg »

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: 10823
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 221 times
Been thanked: 358 times

Macro to change directory in Far command prompt

Post by HaRT »

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: 46
Joined: Fri 01 May, 2015 16:04
Has thanked: 10 times
Been thanked: 1 time

Macro to change directory in Far command prompt

Post by old_gregg »

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: 13807
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 73 times
Been thanked: 426 times
Contact:

Macro to change directory in Far command prompt

Post by John Doe »

Sure you can, using console aliases, as you intended in first post.
old_gregg
Posts: 46
Joined: Fri 01 May, 2015 16:04
Has thanked: 10 times
Been thanked: 1 time

Macro to change directory in Far command prompt

Post by old_gregg »

Are there any docs that explain how to set up a console alias?
User avatar
John Doe
Бюрократ
Posts: 13807
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 73 times
Been thanked: 426 times
Contact:

Macro to change directory in Far command prompt

Post by John Doe »

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”