Skip to main content
Navigator | Tier 3
November 14, 2022
Question

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

  • November 14, 2022
  • 4 replies
  • 1144 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

    Raul Jaimes
    Navigator | Tier 3
    November 15, 2022

    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

     

     

     

     

    Ashwin A.K
    Navigator | Tier 3
    November 15, 2022

    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

    Blogs at TheCodingTheory - https://www.thecodingtheory.com
    Sonny.YAuthor
    Navigator | Tier 3
    November 15, 2022

    Thanks Ashwin! Selected as Best Answer! Very helpful.

    Also Raul's solution was useful too!

     

    Navigator | Tier 3
    November 15, 2022

    @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.