Z
ZoAndrea
Guest
I have a windows application in C# which should run the one text.vbs file. (NET Framework 4 Client Profile)
(When I run this file manually from any location, it does the job normally).
content of text.vbs :
Hidden = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden"
Set Sh = WScript.CreateObject("WScript.Shell")
St = Sh.RegRead(Hidden)
If St = 2 Then
Sh.RegWrite Hidden, 1, "REG_DWORD"
Else
Sh.RegWrite Hidden, 2, "REG_DWORD"
End If
Sh.SendKeys("{F5}")
I've tried many options, but none work.
for example:
private void Button1_Click(object sender, EventArgs e)
{
Process Proc = new Process();
Proc.StartInfo.FileName = @"cscript";
Proc.StartInfo.Arguments = "//B //Nologo c:\\text.vbs";
Proc.Start();
Proc.WaitForExit();
Proc.Close();
}
or
private void Button1_Click(object sender, EventArgs e)
{
RunVBS(@"C:\text.vbs");
}
static void RunVBS(string vbsFilepath)
{
var proc = System.Diagnostics.Process.Start(vbsFilepath);
proc.WaitForExit();
}
is it possible to call a .vbs file using c#.net?
Can anyone please help me on this ?
Thanks in Advance.
Continue reading...
(When I run this file manually from any location, it does the job normally).
content of text.vbs :
Hidden = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden"
Set Sh = WScript.CreateObject("WScript.Shell")
St = Sh.RegRead(Hidden)
If St = 2 Then
Sh.RegWrite Hidden, 1, "REG_DWORD"
Else
Sh.RegWrite Hidden, 2, "REG_DWORD"
End If
Sh.SendKeys("{F5}")
I've tried many options, but none work.
for example:
private void Button1_Click(object sender, EventArgs e)
{
Process Proc = new Process();
Proc.StartInfo.FileName = @"cscript";
Proc.StartInfo.Arguments = "//B //Nologo c:\\text.vbs";
Proc.Start();
Proc.WaitForExit();
Proc.Close();
}
or
private void Button1_Click(object sender, EventArgs e)
{
RunVBS(@"C:\text.vbs");
}
static void RunVBS(string vbsFilepath)
{
var proc = System.Diagnostics.Process.Start(vbsFilepath);
proc.WaitForExit();
}
is it possible to call a .vbs file using c#.net?
Can anyone please help me on this ?
Thanks in Advance.
Continue reading...