Use a variable in the directory

-1

I'm trying to use a variable to save a file to the same directory where it is, but to no avail. I think I will have to use "Environment.ExpandEnvironmentVariables" but I do not know its application. Can you help me?

                    using (FileStream streamX = new FileStream (@"\Server\share\rename\%USERNAME%\myfile.pdf", FileMode.Create))
            {
                stream.WriteTo(streamX);
    
asked by anonymous 18.12.2018 / 16:42

0 answers