Skip to main content


Command Description

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

Command Prototype

sPath = File.ParentPath(filePath)

Parameter Description

filePathTruepath'''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"


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


/************************************Get parent path************ ************************ 
Command prototype:
sPath = File.ParentPath('''C:\Users''')
Input parameters:
filePath--path to file or folder
Outgoing parameters:
sPath--the result after the command is run
Dim filePath='''C:\Users\Chance\Desktop\testFile\data.txt'''
sPath = File.ParentPath(filePath)