开发者

Visual Basic: Copy folder from %appdata% to a new folder

开发者 https://www.devze.com 2023-03-14 10:45 出处:网络
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).

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号