I've seen replying for how to enable the filestream feature by a sql statement. but when the feature is opened, how to restart the sqlserver service instance to made it effects?
You can shutdown SQL Server from T-SQL, but not restart the service. You'll need to do the start using PowerShell (ex: Restart-Service cmdlet) or other command line command like sc.exe.
Or, you could use dbatools PowerShell module do to the whole thing Example for default instance on server1 (error handling to be added):
Enable-DbaFilestream -SqlInstance server1 -FileStreamLevel [1, 2 or 3] Restart-DbaService -ComputerName server1 -Type Engine