Skip to main content


Command Description

Specify a file or folder path to get the name of the corresponding file or folder

Command Prototype

sName = File.BaseName(sPath,bExt)

Parameter Description

sPathTruepath'''C:\Users'''The path of the file or folder. 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"
bExtTruebooleanNoneContain file extension name. The property takes effect only if the path is a file


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


/************************************Get name************* ************************ 
Command prototype:
sName = File.BaseName('''C:\Users''',false)
Input parameters:
sPath--path to file or folder
bExt--Extension containing the file name, this property will only take effect when the path is a file
Outgoing parameters:
sName--the result after the command is run
Dim sPath='''C:\Users\Chance\Desktop\testFile\data.txt'''
sName = File.BaseName(sPath,True)
TracePrint (sName)