I want to create a unique directory for the time a process runs (to complete the copy process I described in this question). I've tried
%random% but it changes too slowly. Waiting is not a viable option, because I write this to speed my copy process up.
So, I'm looking for the PID of the current process of the script I'm in to name the path like it. I need to get it into a variable.
Its fine that the PID gets reused by another process later on, it just needs to be unique as long as my script runs, as I will delete the directory in the end anyway.
I don't need the PID of another process, so this question didn't help me.
I considered using the combination of source and target path (sans the
\), but that could collide with other copy actions running at the same time (e.G. one copies all txt files, another all jpg files both from and to the same directories).
My script is called from another script, so I could present each copy with a distinctive argument, but I'd rather not, cause then I would need to do that in other situations where I want to use the copy too.