Skip to content

Instantly share code, notes, and snippets.

@FGFW
Created May 7, 2018 08:12
Show Gist options
  • Save FGFW/a555aa36849e2ed86897fe85c42fae73 to your computer and use it in GitHub Desktop.
Save FGFW/a555aa36849e2ed86897fe85c42fae73 to your computer and use it in GitHub Desktop.
nim读写注册表的小例子 ref: https://qiita.com/codegay/items/800c0e67c1a0096c0876
import registry
const path = r"SYSTEM\CurrentControlSet\services\LanmanServer\Parameters"
const key = "srvcomment"
proc getsrvcomment():string {.discardable.} =
getUnicodeValue(path, key, HKEY_LOCAL_MACHINE)
echo getsrvcomment()
proc setsrvcomment(comment: string) {.discardable.} =
setUnicodeValue(path, key, val = comment, HKEY_LOCAL_MACHINE)
setsrvcomment("呆瓜小贼 给我上来")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment