How do I reference the current logged in user in a file path when a script is running in Katalon?

We have an issue that we are facing while running scripts by different users. The scripts are supposed to open and upload files from eg: c:/users/currentuser/folder/file in a number of scripts.

Currently, we manually go and change the file path to change it to the current user running the script, it becomes a menace when there are number of scripts that needs to be run and you need to manually go into each script to change the ‘user’ in the file path.

Is there a possibility in Katalon where we can pull the windows username and automatically incorporate that in the file path instead of having to go and change the user manually every time.

1 Like

Try…

String username = System.getProperty("user.name")
String path = "c:/users/${username}/folder/file"
3 Likes

Thanks @Russ_Thomas that worked!!

1 Like