1

I know that for file search on Windows CMD one can use the following command:

dir /S /P "PATH/FILENAME"

Is there an easy way to go straight to the result directory. For example, the requested file is found in:

C:\Program Files................\myProgram\Readme.txt

How to quickly go to that directory via CMD (any commands)? Or one has to simply mark and copy/paste the path on the next prompt?

2 Answers 2

1

I know this is not the exact solution for your question, but you can always open a command prompt at a specified location by navigating to the desired location using windows explorer and then by pressing shift + right click and clicking "Open command window here".

If you already knew this, please disregard this.

Hope it helps.

0

No built-in (DOS) way that I know of, but if you have some common "UNIX" tools available, this will work:

dir /s /p Portal.sln | grep "^ Directory of" | sed -e "s/^ Directory of //" | open.pl

where open.pl is:

#!perl

use strict;
use warnings;

$| = 1;

if (scalar(@ARGV) == 0) {
  print "Please enter the file or folder path you would like to open:\n";
  my $path = <STDIN>;
  chomp $path;
  ConvertAndOpen($path);
}
else {
  foreach my $arg (@ARGV) {
    ConvertAndOpen($arg);
  }
}

sub ConvertAndOpen {
  my $path = shift || die "No path specified";
  $path =~ s/\//\\/g;
  `start "open" "$path"`;
}
1
  • Thanks for the suggestion. I see there is no simple solution.
    – LionBass
    Aug 1, 2014 at 12:15

You must log in to answer this question.

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