cda.bat
@echo off cda.pl %* & \bat\aa.bat
cda.pl
#!/usr/bin/perl ###################################################################### # Name: cda.pl # Desc: CD to alternate directory (optionally to sub-directory). ###################################################################### use strict; use warnings; my $dir = "\\newdir"; if (@ARGV) { $dir .= "\\subdir" . rj(2,'0',shift); } my $ofile = "\\bat\\aa.bat"; open(OFILE, '>', $ofile) or die "Error opening $ofile: $!\n"; print OFILE "cd $dir\n"; print OFILE "cls\n"; print OFILE "dir /p /ogen\n"; close OFILE; exit; ################################################################### # This subroutine adds commas and right-justifies input number. ################################################################### sub rj { my $pad = shift; my $dlm = shift; local($_)=@_; 1 while s/(.*\d)(\d\d\d)/$1,$2/; $_ = ${dlm}x($pad-length($_)).$_; }
"Its not how hard you work, its how much you get done."
In reply to Re: Changing directory in cmd window
by roho
in thread Changing directory in cmd window
by roho
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |