All projects

dos

Some of my batch files and scripts

Some of my batch files and scripts. Jump to the bottom for details about how I have set up my DOS environment as well as listing a few executable/utilities that are frequently used in my batch files.

Setting up the DOS environment

Using aliases (DOSKEY macros)

Saving and retrieving command-line history

Running applications with elevated permissions (as administrator)

These have been deprecated in favor of the PowerShell sudo script. Execute the following to install it via scoop:

> scoop update
> scoop install sudo

Basic utilities and wrappers

Simple menu system

Editors

Securely deleting files

DIR command wrappers

Misc. utilities

I hate iTunes.

Linux on DOS wrappers

The following batch files do a decent job of emulating linux commands in dos. For instance, common '--' arguments are supported and will convert forward slashes to back-slashes.

Also, check out the sections above on aliases and history.

Beyond Compare wrappers

Beyond Compare is one of maybe three apps that I use constantly for so much of my daily work! It rocks.

Git wrappers

I have all but replaced these batch files with aliases (doskey macros). See 'Aliases (DOSKEY macros)' above for more details. I always come back to my batch files. They just work.

Subversion (SVN) wrappers

Vagrant wrappers

Create thumbnail images from .pdf files

Encrypting files

Editing multiple shortcut (.lnk) files

Export and import a shortcut (.lnk) to and from a text file

This little utility is particularly useful as a Beyond Compare File Format.

Easily display and edit the PATH environment variable

Shutdown, Reboot, and Hibernate

Yes, I'm lazy. Actually, in this case, I am more forgetful than lazy, because I can never remember the arguments for shutdown.exe.

 

My DOS environment

While I have tried to always make my batch files work in any environment, you may need to change some variables, envars, and/or paths to suit your needs and your computer environment.

Expected environment variables

%BIN%

This is where all of my utilities live (C:\bin). This includes my exe's and all of my batch and script files. Within this folder is an apps folder (%bin%\apps). Any utility that is larger than one or two files, is put here with its own sub-directory (such as %bin%\apps\tcmd). I create a .bat or .lnk file in %bin% to the utility's main exe buried in the sub-directory.

%PROFILE%

Generally, this is the same as %UserProfile%. The reason I have a separate envar is because I often am working on someone else's computer and launch a console window to use my tools. So, I can set the profile path without affecting Windows' normal behavior, etc.

Note: I have started moving things back to %UserProfile%, instead of %Profile%.

%TOOLS%

This is where the big tools go. Applications such as mingw, Go, Git, Subversion, Mercurial, Google ADK, nodejs, Mono, Python, Perl, Chocolately (I never really got excited about Chocolately and don't use it anymore; scoop fits my style much better), Vagrant, and many more all go here. This folder is HUGE getting smaller as I use scoop for more and more packages.

I generally install tools in a 'version-less' folder, such as %tools%\mono and %tools%\git. I create a new directory under it with the version number in it, to use as a reference. For the rare occasion there is a need to simultaneously install multiple versions, I include the version in the directory name. The only example I have of that is Python 2.x and Python 3.x, which I install to %tools%\Python276 and %tools%\Python334. (For my default Python version, I create an un-versioned junction that points to my default or standard version. In this case I point %tools%\Python (junction) to %tools%\Python334. See link below to download junction.exe.

Expected executable utilities

Some of my batch and script files require additional (executable) utilities. These are listed here.