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?

0

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"`;
}
  • Thanks for the suggestion. I see there is no simple solution. – LionBass Aug 1 '14 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.