c# open file, path starting with %userprofile%

前端 未结 5 742
太阳男子
太阳男子 2020-12-03 06:39

I have a simple problem. I have a path to a file in user directory that looks like this:

%USERPROFILE%\\AppData\\Local\\MyProg\\settings.file
5条回答
  •  温柔的废话
    2020-12-03 06:58

    You can use the Environment.Username constant as well. Both of the %USERPROFILE% and this Environment variable points the same( which is the currently logged user). But if you choose this way, you have to concatenate the path by yourself.

提交回复
热议问题