richardszalay / pshosts

PowerShell cmdlets for modifying the hosts file on Windows, Linux, and macOS
MIT License
119 stars 18 forks source link

Feature Request: -Backup #5

Open NickCraver opened 7 years ago

NickCraver commented 7 years ago

Can we add a -Backup flag (or maybe it takes a path)? e.g. hosts.bak is created before write operations? This would act as a nice failsafe when anything goes wrong.

richardszalay commented 7 years ago

As an alternative, what if write fails were caught and the contents were instead saved to a temp file (the location of which was included in the error message)?