Solved Will this work?

July 8, 2011 at 09:07:02
Specs: Windows 7
Will this work?

attrib +h c:\Users\%CompUser%\AppData\Roaming\Spel_Batch\%GameName%\ThisIsAFile.txt

A little explanation of things:
%CompUser% defines the computer username (the user must enter his/her computer username before he/she can use the batch program)

%GameName% Pretty self-explanatory

What the line of code if supposed to do: Hide the file called "ThisIsAFile.txt"

If it wont work, tell me exactly what to do to make it work :)

Hope you can help me :)

See More: Will this work?

Report •

July 8, 2011 at 09:18:02
✔ Best Answer
It works, just embrace the pathname/Filename with double quotes (") to avoid error if there are embedded blanks, i.e

attrib +h "C:\Users\%CompUser%\AppData\Roaming\Spel_Batch\%GameName%\ThisIsAFile.txt"

Report •

July 8, 2011 at 09:43:25
Just a thought, but if you can safely assume that the logged in user is the username that will be used, you can use the %appdata% variable instead of prompting the user to enter their username.


Report •

July 8, 2011 at 10:13:57
Thanks to both of you :)

Report •

Related Solutions

Ask Question