Visual Basic: Copy folder from %appdata% to a new folder
I'm trying to write a small script that will copy a folder (named .minecraft) to a new folder (doesn't exist, but I want to create a new folder called .minecraft_backups). The current code I have is:
My.Computer.FileSystem.CopyDirectory("%appdata%/.minecraft", "%appdata%/.minecraft_backups", True)
I get an error saying: Could not find directory '%appdata%/.minecraft'. I'm guessing it's because of the %app开发者_开发问答data% shortcut. Is there any workaround to do this? The reason for this is because obviously if I don't enter %appdata% and enter the full route to the directory I need to enter the users username for the computer.
Could anyone write a tiny piece of code to do this?
Try the following to get an string representation of your environment variables.
http://msdn.microsoft.com/en-us/library/system.environment.expandenvironmentvariables.aspx
精彩评论