|
|
One of the most useful scripts in my cygwin arsenal (other than the one that
titles my bash windows - see below) is a quick .pl I whacked together a few
years ago and saw a happy alteration into the land of brevity earlier today:
===== win (.pl)
#!/usr/bin/perl
$path = $#ARGV >= 0 ? $ARGV[0] : $ENV{"PWD"};
open (IN, "/usr/bin/cygpath -wp $path|");
$dosdir = <IN>;
chomp $dosdir;
$dosdir =~ s/\\/\\\\/g;
$syst = system "/C/ronb/bin/win.bat \"$dosdir\"";
if ($syst)
{
print "system (/C/ronb/bin/win.bat \"$dosdir\")\n";
print "syscall returned: $syst\n";
}
===== win.bat
@cd %1
@start .
When I type:
bash> win
...I get a Windows Explorer window of the current directory. If I say:
bash> win /C/foo/bar
...I get c:\foo\bar in an Explorer window. By the way, I do link /C to
/cygdrive/c, /D to /cygdrive/d, etc. Trust me, it's worth it.
-rbarry
|