GetShortPathName()
Summary
Returns the short pathname for a file.
Syntax
short_name = GetShortPathName(string file_name)
| Argument | Contents |
|---|---|
| file_name | Long pathname of the file |
Returns
The pathname without spaces, using the 8.3 naming convention.
Error Codes
| Error Type | Meaning |
|---|---|
| Error | The specified file does not exist |
Notes
-
GetShortPathName() is for compatibility with older applications that cannot handle filenames longer than the old 8.3 naming convention.
-
The return value is a valid Windows pathname that can be used as an alternative to the original, long pathname. For example, if you were to call DeleteFile() using the return value, the original file would be deleted.
-
You can use GetShortPathName() on any path, including folders.
-
If you need to figure out what the folder path is, you can use SplitPath() first.
Example
folder = RunMacro("G30 Tutorial Folder")
file_name = folder + "customer.dbf"
short_name = GetShortPathName(file_name)
ShowMessage("The short pathname for " + file_name + " is " + short_name)
See Also
| Function | Summary |
|---|---|
| CompactPath() | Shortens a file pathname to the listed length for purposes of display |
| GetLongPathName() | Returns the full, long pathname for a file |
| SplitPath() | Splits a path and filename into its component parts |