I tried to add this line to a key in registry
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"-ExecutionPolicy Bypass -windowstyle hidden -noexit -file "%1"
as you see the value that i want to add contains """" and % and - So how can i do it please i know with Registry.SetValue as here
Registry.SetValue(@"HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\Open\Command", "Default", @""C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"-ExecutionPolicy Bypass -windowstyle hidden -noexit -file "%1"");
but errors popup every time i putted @ at the beginning but didnt work also this key will allow me if i edited it to run powershell script by double click on it any ideas ?..thx
Just put another "
to escape each "
Registry.SetValue(@"HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\Open\Command", "Default", @"""C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe""-ExecutionPolicy Bypass -windowstyle hidden -noexit -file ""%1""");