Get short (DOS) path or long path


s.dospath([file] [flags])



s - str variable.

file - full path of file or folder. Default: s.


1 Get long path. If flag 1 is not used, gets short path.
2 QM 2.3.1. If fails to get short path, and the path contains spaces, enclose it in double quotes.



Added in QM 2.2.0.


A file path can have two formats - long and short. Usually are used long paths, but also are supported short paths that were used in DOS. For example, short path version of "c:\program files\some folder\some file.txt" would be "c:\progra~1\somefo~1\somefi~1.txt" or similar. Some programs don't support long paths in command line, so you have to use short path. This function does conversion between long and short path versions.


If file begins with a $spacial folder$ or %environment variable%, this function expands it.


The file/folder must exist, or the function will be unable to get short or long path. If it does not exist, or the function fails for some other reason, s receives file (possibly expanded).


Note: On some computers short path generation is disabled.