. NET method summary for obtaining the current path,. net current path Summary
The following describes how to obtain the current path using. NET (including ASP. NET/WinForm ).
// Obtain the complete path of the current process, including the file
WINFOM get the application's current pathSystem.diagnostics.process.getcurrentprocess (). Mainmodule.filename;Gets the full path of the main module that is associated with the currently active process, including the filename (process name), for the
C # Seven methods for obtaining the current path,
Summary C # Seven methods for obtaining the current path
C # The method for obtaining the current path is as follows:
1. System. Diagnostics. Process. GetCurrentProcess (). MainModule. FileName
Java gets the current path 1, using the System.getproperty () function to get the current path:System.out.println (system.getproperty ("User.dir"));//user.dir specifies the current path 2. Use the function provided by file to get the current path:
C # Gets the current path in the following way:1. System.Diagnostics.Process.GetCurrentProcess (). Mainmodule.filename-Gets the full path of the module.2. System.Environment.CurrentDirectory-Gets and sets the fully qualified directory of the current
------iOS training, Java training, Android training, iOS learning technology blog, looking forward to communicating with you------Calculates the total number of rows for all code files under the current path . total number of c\.h\.m files
There are many function files in java that obtain the current path and the absolute path. I will introduce you to the usage of related functions in detail. If you need them, refer to them.
Current path
1. Use the System. getProperty () function to
Directly on the code:See if there is a DB folder under the path to the execution file, and if not, create a new/////////CFileFind CFF;if (CFF. FindFile (_t ("db")) = = 0)//current path, DB folder not found{CString StrText;TCHAR exepath[max_path]={0};
Today is the second time I published an article. It's rare. No way, my eyes hurt, but I still stick to the spirit of "Working Hard For Me, serving thousands of families, I will continue to write my article. Lecture ing...
//--------------------------
Current path1. Use the System. getProperty () function to obtain the current path: The code is as follows:Copy code System. out. println (System. getProperty ("user. dir"); // user. dir specifies the current path. 2. Use the function provided
------iOS training, Java training, Android training, iOS learning technology blog, looking forward to communicating with you------Calculates the total number of rows for all files under the current path/*calculates the total number of rows for all
Java gets the current path and reads the file1. Use the System.getproperty () function to get the current path:System.out.println (system.getproperty ("User.dir"));//user.dir Specifies the current path2. Use the function provided by file to get the
1. Use the System.getproperty () function to get the current path:System.out.println (System.getproperty ("User.dir"));//user.dir Specifies the current path2. Use the function provided by file to get the current path:File directory = new file ("");//
Move from my Netease blog.
In general, open a file in the current path. That's all.
File f = new File ("1.txt ");
It runs normally on eclipse. The path is the directory of the current project.
But after packaging. Run the jar package. Although
In practical applications, the C ++ programming language helps developers easily implement various functions and requirements. For example, you can flexibly use various methods to perform operations on files. Next, we will introduce how C ++ obtains
1. Use the System.getproperty () function to get the current path:System.out.println (System.getproperty ("User.dir"));//user.dir Specifies the current path2. Use the function provided by file to get the current path:File directory = new file ("");//
1. Use the System.getproperty () function to get the current path:System.out.println (System.getproperty ("User.dir"));//user.dir Specifies the current path2. Use the function provided by file to get the current path:File directory = new file ("");
1. Use the System.getproperty () function to get the current path:System.out.println (System.getproperty ("User.dir"));//user.dir Specifies the current path2. Use the function provided by file to get the current path:File directory = new file ("");//
This article summarizes. NET (including Asp.net/winform, etc.) to obtain the current path of the various methods, with a certain reference value, followed by a small series to see it together
The following summarizes the various ways that. NET
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.