d使用注册表的示例.

import std.stdio;
import std.windows.registry;

void main(string[] args)
{
    writeln("hello world");
    writefln("args.length = %d", args.length);

    foreach (index, arg; args)
    {
        writefln("args[%d] = '%s'", index, arg);
    }
	writeln();
	writeln(Registry.localMachine().name);
	writeln(Registry.localMachine().getKey("System\\CurrentControlSet\\Control\\Session Manager\\Environment").name);
	writeln(Registry.localMachine().getKey("System").keyCount);
	writeln(Registry.localMachine().getKey("System").valueCount);
	writeln(Registry.localMachine().getKey("System\\CurrentControlSet\\Control\\Session Manager\\Environment").valueCount);
	write(Registry.localMachine().getKey("System\\CurrentControlSet\\Control\\Session Manager\\Environment").getValue("Path").value_EXPAND_SZ);
	Registry.currentUser().createKey("test");

}
posted @ 2021-11-28 09:15  zjh6  阅读(15)  评论(0)    收藏  举报  来源