Adds quotes to a path if it needs it.
Syntax
NewPath = SRP_Path("Quote", Path)
Parameters
Parameter | Description |
---|---|
Path | A path with or without command line parameters. |
Returns
The path with quotes, if quotes were deemed necessary.
Remarks
The Quote service surrounds the path with quotes, but only if it decides it is necessary. First, the path is parsed. If it discovers that the path is already quoted, then it just returns the original path. If it wasn't, then it determines were the quotes need to be. First, it looks for an extension and uses that as the denoting the end of the path. If there is no extension, then the first space is used to determine the end of the path. In other words, if you pass a path with no quotes, it will assume that spaces indicate command line parameters. If you are certain that your path will never have command line parameters but might have spaces, you are better of just using the BASIC+ Quote function.
Example
Path = 'C:\path1\path2\filename.ext a=1 /b=2 -c="stuff with spaces"' Result1 = SRP_Path("Quote", Path) Path = 'C:\path 1\path 2\filename.ext a=1 /b=2 -c="stuff with spaces"' Result2 = SRP_Path("Quote", Path) Path = 'C:\path 1\path 2\filename a=1 /b=2 -c="stuff with spaces"' Result3 = SRP_Path("Quote", Path)
Result1 will be the same as Path because quotes were not needed. Result2 will be '"C:\path 1\path 2\filename.ext" a=1 /b=2 -c="stuff with spaces"' because ".ext" was found. Result3 will be 'C:\path 1\path 2\filename a=1 /b=2 -c="stuff with spaces"' since no extension was discovered.