Simple self restartable windows service

To make a self restartable service simple cmd script may be used.
Code is in C#:

private void RestartSrv()
{
	_log.Debug($"RestartSrv()");
	try
	{
		var name = "SomeServiceName";

		var f = @"C:\restart.cmd"; // put this somewhere

		_log.Trace($"creating {f}");

		var cmd = new string[]
		{
			"@ECHO OFF",
			$"net stop {name}",
			"PING -n 20 127.0.0.1 > NUL",
			$"net start {name}",
		};

		File.WriteAllLines(f, cmd, Encoding.ASCII);

		_log.Trace($"launching {f}");
		var nfo = new ProcessStartInfo(f);
		Process.Start(nfo);
	}
	catch (Exception ex)
	{
		_log.Error(ex, "RestartSrv()");
	}
	
}