Note: This is the migration API reference for FAKE 5. The new (modularized) API documentation can be found here. If the API is already migrated you can check here if exists in a module. More information regarding the migration can be found here

Registry

Contains functions which allow to read and write information from/to the registry.

Sample

Create a subkey

1: 
2: 
let subkey = "Company/MyApp"
Registry.createRegistrySubKey Registry.HKEYCurrentUser subkey

Write a key-value pair to a subkey

1: 
2: 
Registry.setRegistryValue Registry.HKEYCurrentUser subkey "AppType" "Premium"
Registry.setRegistryValue Registry.HKEYCurrentUser subkey "Version" "1.0.4"

Get a list of key-value names in a subkey

1: 
2: 
let values = Registry.getRegistryValueNames Registry.HKEYCurrentUser subkey
values |> Array.iter (Trace.trace << (sprintf "Found value name: %s!"))

Read the value of a key-value pair

1: 
2: 
let AppType = Registry.getRegistryValue Registry.HKEYCurrentUser subkey values.[0]
Trace.trace (sprintf "You are running the %s version" AppType)

Check if a value exists within a subkey

1: 
2: 
3: 
let exists b = if b then Trace.trace "It exists!" else Trace.trace "It doesn't exist!"
exists <| Registry.valueExistsForKey Registry.HKEYCurrentUser subkey "DateCreated"
exists <| Registry.valueExistsForKey Registry.HKEYCurrentUser subkey "Version"

Delete a key-value pair from a subkey

1: 
Registry.deleteRegistryValue Registry.HKEYCurrentUser subkey "AppType"

Delete a subkey

1: 
Registry.deleteRegistrySubKey Registry.HKEYCurrentUser subkey
val subkey : string
val values : string []
module Array

from Microsoft.FSharp.Collections
val iter : action:('T -> unit) -> array:'T [] -> unit
val sprintf : format:Printf.StringFormat<'T> -> 'T
val AppType : obj
val exists : b:bool -> 'a
val b : bool

Nested types and modules

TypeDescription
RegistryBaseKey

Registry base keys.

Functions and values

Function or valueDescription
Registry.createRegistrySubKey(...)
Signature: baseKey:RegistryBaseKey -> subKey:string -> unit

Create a registry subKey

Registry.deleteRegistrySubKey(...)
Signature: baseKey:RegistryBaseKey -> subKey:string -> unit

Deletes a registry subKey

Registry.deleteRegistryValue(...)
Signature: baseKey:RegistryBaseKey -> subKey:string -> name:string -> unit

Deletes the registry value from its key

Registry.getRegistryKey(...)
Signature: baseKey:RegistryBaseKey -> subKey:string -> writePermission:bool -> RegistryKey

Gets a registry key and falls back to 32 bit if the 64bit key is not there

Registry.getRegistryKey64(...)
Signature: baseKey:RegistryBaseKey -> subKey:string -> writePermission:bool -> RegistryKey

Gets a 64-bit registry key

Registry.getRegistrySubKeyNames(...)
Signature: baseKey:RegistryBaseKey -> subKey:string -> string []

Returns all the subKey names of a registry key

Registry.getRegistryValue(...)
Signature: baseKey:RegistryBaseKey -> subKey:string -> name:string -> string

Gets a registry value as string

Registry.getRegistryValue64(...)
Signature: baseKey:RegistryBaseKey -> subKey:string -> name:string -> string

Gets a registry value as string

Registry.getRegistryValueNames(...)
Signature: baseKey:RegistryBaseKey -> subKey:string -> string []

Returns all the value names of a registry key

Registry.setRegistryValue(...)
Signature: baseKey:RegistryBaseKey -> subKey:string -> name:string -> value:'T -> unit
Type parameters: 'T

Sets a registry value

Registry.valueExistsForKey(...)
Signature: baseKey:RegistryBaseKey -> subKey:string -> name:string -> bool

Returns whether or not a registry value name exists for a key