Question

how to access files in c:\user\username\downloads folder?

  • 14 November 2022
  • 4 replies
  • 467 views

I'm creating a bot that is able to access folder:

c:\user\username\downloads (username can be dynamic depends on who's

logged on the computer to use the bot)

Please see screen shot and kindly advise.

thanks,


4 replies

Userlevel 5
Badge +9

Hi,

 

You can use a bat file to get the enviroment variable %userprofile% and get the path using the system variable AAInstallationPath ($System:AAInstallationPath$)

 

echo %USERPROFILE%\Downloads > C:\Program Files\Automation Anywhere\Bot Agent\my_path.txt

 

Usually C:\Program Files\Automation Anywhere\Bot Agent is AAInstallationPath whose is accesible by the bot in order to read the path in the file.

 

Regards

 

 

 

 

Userlevel 4
Badge +7

Hi @Sonny Yuan​ ,

 

If only the Username is dynamic, then you can use the System: Get Environment Variable Action and retrieve the Username.

 

imageThis username can then be placed in the filepath like so:

 

image 

Kind Regards,

Ashwin A.K

Thanks Ashwin! Selected as Best Answer! Very helpful.

Also Raul's solution was useful too!

 

Badge +6

@Sonny Yuan​ - Alternative approach, If you don't want to create additional variable and don't want to add additional line then we can directly pass $SystemVariablesPackage:UserName$ in field. It returns you the same result.

Reply