Hello all,
I hope everyone are doing well.
I would like to know how I can replace a character in a path every time this character appears.
For example I want to replace the asterisk for the username in order to get the user name of the user where the bot is going to be run.
I know I can do this ;
username = System.Environment.UserName
filePath=“C:\Users*\Desktop\Test\Test.txt”
filePath.Replace(“*”, username) =“C:\Users\DJohn\Desktop\Test\Test.txt”
However, I would like to perform only one time for all the activities in the flow which contains an asterisk on the path
Anyone has any idea
why are you doing that, i think is better to replace directly C:\Users\“+Environment.UserName+”\Desktop\Test\Test.txt
regards!
You could also use “Get Environment Folder” activity if you wanted to reference the current users desktop as a variable:
postwick
(Paul Ostwick)
March 29, 2022, 7:32pm
5
You know that it’ll always start with "C:\Users" and end with “\Desktop\Test\Test.txt” so just do…
“C:\Users\” + System.Environment.Username + “\Desktop\Test\Test.txt”
ppr
(Peter Preuss)
March 29, 2022, 8:16pm
6
in addition to above also have a look at following:
1 Like
postwick
(Paul Ostwick)
March 29, 2022, 9:23pm
7
Oooohhhh I never knew about those.
There are some very useful ones here! Oddly, the Downloads folder isn’t one of them.
1 Like