Skip to content

Commit

Permalink
Handle spaces in service names and in backup folder path
Browse files Browse the repository at this point in the history
  • Loading branch information
Fs00 committed Sep 12, 2020
1 parent 1575030 commit 4e36c3d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Operations/ServiceRemover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private void BackupService(string service)
{
EnsureBackupDirectoryExists();
int regExportExitCode = SystemUtils.RunProcessBlocking(
"reg", $@"export HKLM\SYSTEM\CurrentControlSet\Services\{service} {backupDirectory.FullName}\{service}.reg"
"reg", $@"export ""HKLM\SYSTEM\CurrentControlSet\Services\{service}"" ""{backupDirectory.FullName}\{service}.reg"""
);
if (regExportExitCode == 0)
ui.PrintMessage($"Service {service} backed up.");
Expand All @@ -103,7 +103,7 @@ private void PerformRemoval(string[] backuppedServices)

private void RemoveService(string service)
{
int scExitCode = SystemUtils.RunProcessBlocking("sc", $"delete {service}");
int scExitCode = SystemUtils.RunProcessBlocking("sc", $"delete \"{service}\"");
if (IsScExitCodeSuccessful(scExitCode))
PrintSuccessMessage(scExitCode, service);
else
Expand Down

0 comments on commit 4e36c3d

Please sign in to comment.