How could i translate this in c#?
Set WshShell = WScript.CreateObject( "WScript.Shell" )
Thx. At what is this used? And also what is the library i have to include in c# in order to work?
How could i translate this in c#?
Set WshShell = WScript.CreateObject( "WScript.Shell" )
Thx. At what is this used? And also what is the library i have to include in c# in order to work?
There are still some things more easily accomplished with the Shell objects for Scripting. You can get access from .NET using
var sh = (Shell32.IShellDispatch4)Activator.CreateInstance(
Type.GetTypeFromProgID("Shell.Application"));
(add a reference to Shell32.dll to have the interop classes created)
You shouldn't - and maybe it isn't even possible. You should use the native classes of the .NET framework to achieve what you want. Depending on what is done with that object, there are several classes in .NET that can be used. If you show the usage of WshShell
we can tell you the corresponding class in the .NET framework.
WshShell gives you a reference to several commands and environment variables within windows. When dealing with C# you use different things to retrieve the different variables/commands. For example WshShell.Run translates to Process.Run. System.Environment.GetEnvironmentVariable can be used to get environment variables... So the actual answer depends on what you want to do.