Get drive letter
If you run portable devices from a USB stick, sometimes you need to refer to other files that is in the same USB drive. Their relative position is stable, but the drive letter is not. Thus, referring to those files by absolute path doesn't work, unless you do the tedious modifications every time.
- Method 1:
- Method 2:
set var=%~d0(preferred) Use variable:
Alias on M$ Win*
If you’re familiar with *nix and use M$-DOS, you may unconsciously
ls command in DOS; or if you have a portable version of a
software and you need to launch it by command, you will discover the
difference between the name of the programs—one has
portable at the
end while the other one doesn’t.
Copy and paste the following lines of code into any text editor.
Save the whole file as
[alias].bat and put the file under any folder
PATH environment variable.
[alias] in the command prompt to see the effect.
% in M$ Win* is the same as
$* in *nix.1