Search notes:

Script: pc.pl

Copy the current path into the clipboard.
#
#   Copies the current path to the clipboard
#
#   Dec 14: On Windows, the same thing can be achieved
#   with a
#     <nul set /p ="%CD%"|clip
#   Yet, the echo also writes 
#

use warnings; use strict;

use Cwd;
use Win32::Clipboard;

my $escape_backslashes   = 0;
my $make_forward_slashes = 0;
if (@ARGV) {

  my $opt = shift @ARGV;
  if ($opt eq '\\') {
      $escape_backslashes = 1;
  }
  elsif ($opt eq '/') {
      $make_forward_slashes = 1;
  }
  elsif (substr($opt, 0, 2) eq '-h') {
      help();
      exit 0;
  }
}

my $path = getcwd;

if (!$make_forward_slashes) {
  $path =~ s/\//\\/g;
}
if ($escape_backslashes) {
  $path =~ s/\\/\\\\/g;
}


Win32::Clipboard -> Set($path);

sub help {
  print '
  
    pc
    pc /     return c:/path/to/file.txt
    pc \     return c:\\\\path\\\\to\\\\file.txt

  ';

}
Github repository scripts-and-utilities, path: /pc.pl

Using clip

@echo %cd% | clip

See also

pc, pc.bat
Scripts

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759390563, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/tools/scripts/personal/pc_pl(100): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78