File Exception, Access is denied - prompting for administrator's rights

BoQsc vaidas.boqsc at gmail.com
Tue Jun 4 16:30:41 UTC 2019


Hello everyone, I'm Windows 10 as of right now,
I have this situation where I would like to update /hosts file, 
however sometimes I do not have the required permissions, since 
sometimes I forget to run the .d script with administrator's 
rights. Is there any way to prompt for administrator's rights, to 
save the additional effort of lots of clicks?


import std.file;

void main(){
	append("C:/Windows/System32/drivers/etc/hosts", "hahaha");
}



std.file.FileException at std\file.d(859): 
C:/Windows/System32/drivers/etc/hosts: Access is denied.
----------------
0x00404223
0x00402295
0x00403751
0x004035EB
0x00402DE7
0x75688494 in BaseThreadInitThunk
0x773741C8 in RtlAreBitsSet
0x77374198 in RtlAreBitsSet



More information about the Digitalmars-d-learn mailing list