Answers for "powershell get user directory"


get directory of file python

import os 
dir_path = os.path.dirname(os.path.realpath(__file__))
Posted by: Guest on April-03-2020

get user directory of file in c#

using (OpenFileDialog openFileDialog = new OpenFileDialog())
                // TODO: Use LocalUser instead of Hardcode
                openFileDialog.InitialDirectory = @"C:\Users\username\Desktop"; 
                openFileDialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
                openFileDialog.FilterIndex = 2;
                openFileDialog.RestoreDirectory = true;

                if (openFileDialog.ShowDialog() == DialogResult.OK)
                    //Get the path of specified file
                    filePath = openFileDialog.FileName;

                    //Read the contents of the file into a stream
                    var fileStream = openFileDialog.OpenFile();

                    using (StreamReader reader = new StreamReader(fileStream))
                        fileContent = reader.ReadToEnd();
Posted by: Guest on March-20-2020

Code answers related to "powershell get user directory"

Python Answers by Framework

Browse Popular Code Answers by Language