AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

PD - Push Directory - Create Aliases [CMD]

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Utilities & Resources
View previous topic :: View next topic  
Author Message
BoBo
Guest





PostPosted: Fri Jan 28, 2005 1:29 pm    Post subject: PD - Push Directory - Create Aliases [CMD] Reply with quote

Quote:
PD aka Push directory. A simple little replacement for the Windows command-line cd command.

You can pop back to any other directory you've pd'ed to in your history

The most useful thing that PD does is allow creation of aliases. For example, if you're in the directory C:\Program Files\Microsoft Visual Studio\vc98\include, you can type "pd +inc" to set an alias for that directory, after which "pd inc" goes directly there. For you command-line junkies out there like myself, you'll find this very useful.

Also of note is that it is a 32-bit program unlike most other programs of this type (in fact, I couldn't find any)! That means PD is fully literate with respect to windows long names (i.e. it doesn't munch directories into tilde-ridden 8.3 short-names). This is probably the most fun part of this program, since doing this as a 32-bit program required quite a bit of tricky code. Read the fully commented code for the exciting details, but a quick summary: PD alters itself to have debugger priviledges, gets the parent process ID for cmd.exe, and injects code to perform the directory change with WriteProcessMemory and CreateRemoteThread. All to work around something that worked fine with 16-bit command-line apps!

Note: the cd command within cmd.exe "cheats"--it doesn't actually use the current directory, but a local string that it thinks is the directory. What that means is that if you've "pd"ed to a directory, and try to cd from there, cd gets confused because it thinks it's somewhere else. You're really in the right directory; the prompt will tell you that. While I might attempt to fix the stupid cd command at some point, the easiest solution is just to use pd all the time.

[Download]
Back to top
BoBo
Guest





PostPosted: Fri Jan 28, 2005 1:30 pm    Post subject: Reply with quote

Quote:
pd -- Push Directory
Version 2.02. Copyright (c) 2004, Andrew J. Gryc

Environment vars PDALIASES and PDHISTORY override default location of alias
and history files (default location is same directory as executable).

Commands:
pd ? Prints directory history and current aliases.
pd --help Prints this help (-? also prints help).

History commands:
pd <dir> Pushes the current directory and changes to <dir>.
pd Pops back to the last directory pushed.
pd @ Adds current directory to history list.
pd @<dir> Adds <dir> to history list.
pd <number> Returns to (and does not pop) nth directory.
pd -<number> Deletes nth directory from history.

Alias commands (aliases are case-sensitive and can contain special chars):
pd alias Goes to directory named by alias.
pd alias/<dir> Goes to subdirectory of the aliased directory.
pd alias\<dir> Same (slashes and backslashes both work).
pd +alias Sets an alias name for the current directory.
pd +alias=<dir> Sets an alias name for <dir>.
pd -alias Removes an alias.
pd !<cmdline> Replaces any aliases, then executes <cmdline>.
pd ! Starts pseudo-shell that replaces aliases.
Back to top
jonny



Joined: 13 Nov 2004
Posts: 3005
Location: Minnesota

PostPosted: Fri Jan 28, 2005 8:19 pm    Post subject: Reply with quote

Remember to include a homepage link, too, BoBo! Rolling Eyes

[Covering for BoBo]
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Fri Jan 28, 2005 9:46 pm    Post subject: Reply with quote

@ Jonny
click at the link you've provided and once that page has loaded - compare it with the posting above yours.
Breathe deeply 5 times.
Now, be ashamed Laughing
Back to top
jonny



Joined: 13 Nov 2004
Posts: 3005
Location: Minnesota

PostPosted: Fri Jan 28, 2005 10:33 pm    Post subject: Reply with quote

A quote is never a substitute for the real thing. I'm fully aware that you posted all relevant info, but it still just feels better to be at the source. And besides, how is an innocent bystander supposed to know that's all the info? Also, what if we want to pay our respects to the author, find out more about him, and see if he has any other software? Most of this info is too much for a quote but still relevant to some.

I stand by my comment. Wink An ideal util post: Short summary, with an (optional) quote no longer than one full-screen page, and at least two links; homepage, download page. (Or direct download link) Just my thoughts. Smile

Remember: Links make the www go round!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Utilities & Resources All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group