Skip to main content

Read-File

Command Description

Specify a file path and read the contents of the file corresponding to the path

Command Prototype

sRet = File.Read(sPath,sCharset)

Parameter Description

ParameterRequiredTypeDefaultDescription
sPathTruepath'''C:\Users'''The path of the file to be read. 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"
sCharsetTrueenum"auto"File character set encoding

return

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

Demo

/************************************Read file************ **************************** 
Command prototype:
sRet = File.Read('''C:\Users''',"auto")
Input parameters:
sPath--the file path to read
sCharset--file character set encoding
Outgoing parameters:
sRet--the result after the command is run
********************************************************************************/
Dim sPath='''C:\Users\Chance\Desktop\testFile\data.txt'''
sRet = File.Read(sPath,"auto")
TracePrint (sRet)