Command-Line Tools
These are a few simple command-line tools that I've written and use pretty much every day.- wi - Find an executable file on the path.
- whoami - Display your user name, the groups you belong to, and your privileges.
- echodate - Output a date in a variety of formats.
wi
Wi (short for Where Is) is a command-line program to tell you where a certain executable is located in your system's path.C:\>wi rar c:\uty\Rar.exe C:\>wi rar* c:\remotelyanywhere\RAReboot.exe c:\uty\Rar.exe c:\uty\rar330b5.exe C:\>
Download
LEGAL NOTICE: You're granted the license to freely use WI.
You may not redistribute, sell or re-sell it. Anything else you do with it is at your sole
responsibility. The creator or publisher cannot be held liable for any damages, direct or indirect,
that result from the use of this software. By running the software you agree to be bound
by these terms.
Follow this link to download: wi.zip - 20K
InstallSimply unpack the zip file to a directory of your choice and run the executable.
whoami
WhoAmI is a command-line program to tell you who exactly you are in your Windows computer (and on your Windows network). It will tell you your account name (well, duh) and all the groups you are a member of. It will also tell you what privileges you have.
C:\>whoami
whoami 1.01 (C)2005 CodeFromThe70s.org
User: DUALXEON\Marton
Groups: DUALXEON\None
Everyone
DUALXEON\Debugger Users
BUILTIN\Administrators
BUILTIN\Users
NT AUTHORITY\INTERACTIVE
NT AUTHORITY\Authenticated Users
LOCAL
Privileges: Default - Bypass traverse checking (SeChangeNotifyPrivilege)
- Manage auditing and security log (SeSecurityPrivilege)
- Back up files and directories (SeBackupPrivilege)
- Restore files and directories (SeRestorePrivilege)
- Change the system time (SeSystemtimePrivilege)
- Shut down the system (SeShutdownPrivilege)
- Force shutdown from a remote system
(SeRemoteShutdownPrivilege)
- Take ownership of files or other objects
(SeTakeOwnershipPrivilege)
- Debug programs (SeDebugPrivilege)
- Modify firmware environment values
(SeSystemEnvironmentPrivilege)
- Profile system performance (SeSystemProfilePrivilege)
- Profile single process (SeProfileSingleProcessPrivilege)
- Increase scheduling priority
(SeIncreaseBasePriorityPrivilege)
Enabled - Load and unload device drivers (SeLoadDriverPrivilege)
- Create a pagefile (SeCreatePagefilePrivilege)
- Adjust memory quotas for a process
(SeIncreaseQuotaPrivilege)
Enabled - Remove computer from docking station (SeUndockPrivilege)
- Perform volume maintenance tasks
(SeManageVolumePrivilege)
Default - Create global objects (SeCreateGlobalPrivilege)
Default - Impersonate a client after authentication
(SeImpersonatePrivilege)
C:\>
Download
LEGAL NOTICE: You're granted the license to freely use WI.
You may not redistribute, sell or re-sell it. Anything else you do with it is at your sole
responsibility. The creator or publisher cannot be held liable for any damages, direct or indirect,
that result from the use of this software. By running the software you agree to be bound
by these terms.
Follow this link to download: whoami.zip - 17K
InstallSimply unpack the zip file to a directory of your choice and run the executable.
echodate
Echodate is an executable wrapper around strftime(). Sounds oh-not-so-exciting? It's actually quite useful if you think about it. Consider the following batch file:echodate "rar m -m5 ex%y%m%d.log webserver%Y%m%d.log.rar" -86400 > #@#tmp.cmd call #@#tmp.cmd del #@#tmp.cmdThe above batch file will generate and call this one:
rar m -m5 ex060226.log webserver20060226.log.rarSchedule this to run at 4am in your webserver's log directory, and it will automatically archive yesterday's log for you.
This is just one example - whenever you need pretty much anything date-related in a batch file, echodate will come in handy.
There are two parameters, both of them optional.
- The first parameter is a format string that gets passed to strftime() alongside with today's date.
- The second parameter is a time offset in seconds. This is added to the date before it's passed to strftime().
Z:\>echodate 060226 Z:\>Specifying a format string:
Z:\>echodate %#c Sunday, February 26, 2006 18:41:15 Z:\>Specifying a format string and an offset:
Z:\>echodate %#c -864000 Thursday, February 16, 2006 18:42:10 Z:\>
Download
LEGAL NOTICE: You're granted the license to freely use echodate.
You may not redistribute, sell or re-sell it. Anything else you do with it is at your sole
responsibility. The creator or publisher cannot be held liable for any damages, direct or indirect,
that result from the use of this software. By running the software you agree to be bound
by these terms.
Follow this link to download: echodate.zip - 33K
InstallSimply unpack the zip file to a directory of your choice and run the executable.