Access file in Resources C# -
i import registry
.reg file exist in project resources
.
the way import reg file uses path reg file:
process proc = new process(); proc = process.start("regedit.exe", "/s " + "path\to\file.reg");
is possible file resources? how path?
if in project folder. i-e. folder in project runnung. can access directly : process.start("regedit.exe", "/s " + "filename.reg");
you can current path using
string path =system.appdomain.currentdomain.basedirectory; // give u path debug folder
or
string projectpath= path.getdirectoryname(path.getdirectoryname(system.io.directory.getcurrentdirectory())); //this give u project path.
you can use both , navigate arround path desired folder. eg if want access file in resource folder inside project folder u can use projectpath+"\\resource\\filename.reg"
Comments
Post a Comment