Boberito
(Bob)
1
Is there a way with Swift to work with the Windows registry to set and read settings
Currently I'm creating a small command line binary that runs on Mac, Windows, and Linux.
On Windows for the settings required I'm doing
task.standardOutput = pipe
task.standardError = pipe
task.executableURL = URL(fileURLWithPath:"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe")
task.arguments = ["Get-ItemProperty -path 'Registry::HKEY_CURRENT_USER\\jamf-utility'"]
try task.run()
Then parsing the output from running a powershell command to read from the registry. But I'm hoping there's a better way to read from the registry using Swift.
compnerd
(Saleem Abdulrasool)
2
Yes, see GitHub - compnerd/swift-win32: A Windows application framework for Swift for an example for accessing the registry. In particular, the Device.systemName property accesses the registry.
2 Likes