Skip to main content

Get-File-Extension-Name

Command Description

Specify a file path and get the file extension of the file corresponding to the path

Command Prototype

sNameExtension = File.ExtensionName(sPath)

Parameter Description

ParameterRequiredTypeDefaultDescription
sPathTruepath'''C:\Users'''The path of the file, you can fill in the absolute path or use the @res "path" form to indicate the path under the res folder of the current process, the path separator must be escaped, such as "C:\Laiye RPA" or @res"Laiye RPA\Laiye RPA "

return

sNameExtension,The variable used to save the output of the command.

Demo

/********************************Get file extension ************* ********************* 
Command prototype:
sNameExtension = File.ExtensionName('''C:\Users''')
Input parameters:
sPath--path to file
Outgoing parameters:
sNameExtension--the result of running the command
********************************************************************************/
Dim sPath='''C:\Users\Chance\Desktop\testFile\data.txt'''
sNameExtension = File.ExtensionName(sPath)
TracePrint(sNameExtension)