How to call farmanager from the command line ?!

You have encountered a problem using Far Manager? Here you can get help.
Post Reply
viktorijakup
Posts: 3
Joined: Mon 29 Sep, 2008 07:38

How to call farmanager from the command line ?!

Post by viktorijakup »

HI !

This script open folder in win explorer.

How to call farmanager from the command line ?!

Code: Select all

@rem = '--*-Perl-*--
@echo off
if "%OS%" == "Windows_NT" goto WinNT
perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
goto endofperl
:WinNT
perl -x -S %0 %*
if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
if %errorlevel% == 9009 echo You do not have Perl in your PATH.
if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
goto endofperl
@rem ';
#!/usr/bin/perl
use warnings;
use strict;
use File::Path;
use Cwd;
use File::Copy;
use File::Spec::Functions;
use FileHandle;
#hardcoded 
my $FP = 'Y:\graphics_qc';
my $TP = 'Y:\plot_db';
my ($from_file, $to_file) = ($ARGV[0], $ARGV[0]);
my $cwd = `cd`;
chomp $cwd;
my ($from_dir, $to_dir) = ($cwd, $cwd);
#rename dir part
$to_dir =~ s/^\Q$FP\E/$TP/;
mkpath($to_dir);
system("start $to_dir"); # this will open folder in win explorer
system("start $from_dir"); # this will open folder in win explorer
exit 0;

__END__
:endofperl
Regards,

Viki
User avatar
HaRT
Moderator
Posts: 10867
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 221 times
Been thanked: 358 times

Re: How to call farmanager from the command line ?!

Post by HaRT »

viktorijakup
:rtfm: You should read the «Command line switches» section in the Help.
Фар есть инструмент, а не нянька. © 2009 DrKnS
viktorijakup
Posts: 3
Joined: Mon 29 Sep, 2008 07:38

Re: How to call farmanager from the command line ?!

Post by viktorijakup »

Hi !!!

Could you write me an example ?!

Viki
dolzenko
Posts: 452
Joined: Wed 19 Apr, 2006 14:42
Location: Ростов-на-Дону

Re: How to call farmanager from the command line ?!

Post by dolzenko »

oh my
FAR: command line switches wrote: It is possible to specify at most two paths to folder, files or archives in the command line. The first path applies to the active panel, the second path - to the passive
one:

- if a folder or archive is specified, FAR will show its contents

- if a file is specified, FAR will change to the folder where it
resides and place the cursor on the file, if it exists.
User avatar
t-rex
Страшный и ужасный
Posts: 4910
Joined: Tue 15 Mar, 2005 16:17
Location: Tel-Aviv
Has thanked: 1 time
Been thanked: 8 times
Contact:

Re: How to call farmanager from the command line ?!

Post by t-rex »

Change

Code: Select all

system("start $to_dir"); # this will open folder in win explorer
system("start $from_dir"); # this will open folder in win explorer
to

Code: Select all

system("start Far.exe $from_dir $to_dir"); # this will open both folders in Far
viktorijakup
Posts: 3
Joined: Mon 29 Sep, 2008 07:38

Re: How to call farmanager from the command line ?!

Post by viktorijakup »

HI !!!

Thank you very mach !!!

:good:
creast
Posts: 1
Joined: Mon 07 Apr, 2014 19:52

Newbie question: command line to open in directory

Post by creast »

I need to open farmanager in a specified folder/network from command prompt, what is the syntax for this?
Shmuel
Posts: 6840
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 530 times

Re: Newbie question: command line to open in directory

Post by Shmuel »

Press F1, and read the "Command line switches" section.
Post Reply

Return to “Support and Troubleshooting”