Do not specify the path to a batch file

0

To open a file on my computer, just put the path. C: \ Users \ User \ Desktop \ example \ example2.txt But if I am to create a batch for another computer, assuming there is a folder on the desktop called "example" and a file inside it called "example2", it probably would not work, since the "User "would be another name (in this case, the person's computer), is there any way around that?

    
asked by anonymous 19.11.2017 / 03:40

1 answer

2

Try to use the% userprofile% variable instead of user

example:

%userprofile%\Desktop

It will directly access the user, regardless of what it is.

    
19.11.2017 / 04:06