I’m looking for some help with the environment variable %COMPUTERNAME%. It is working in my script as a means to name a file after the local host name. At another point I am using the script to build a folder in a different directory over the network (to a mapped drive) and I need to name the folder the local host name of the original computer. This may not make sense but I will provide an example below:
Comp1 = BobPC
Comp2 = JakePC
I am making a zip file on BobPC, which is then being copied over to JakePC, but I need this file to be copied into a directory like… C:\CopiedFiles\BobPc because this script will be run on many computers and each of them needs a folder where the files will be located named after the computer it came from.
I hope this makes sense.
Right now I can make it build a folder just fine but it names it the name of “JakePC” obviously because I am using the environment variables to grab the local host name.
My question basically is how can I go about telling it to name the folder after the the original computer?
If you have any questions let me know, I will be more than happy to explain because I know that I might not be making much sense.
In case you run the script from the source pc you can use the following
in case you run it from the targetpc you should use remote scripting but that would not be smart since you must know the name of the pc where you need to run it so there is no need for the environmentvariable.