TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sanjay Darekar
NA
61
1.4k
How To ExcecuteCommandSyncronisation in ASPNET
Oct 3 2015 2:33 AM
In CheckSerial() function there is one key in res result how to work that code
public static string CheckSerial()
{
string res = ExecuteCommandSync("vol");
const string search = "Number is";
int startI = res.IndexOf(search, StringComparison.InvariantCultureIgnoreCase);
string currentDiskID = "";
if (startI > 0)
{
currentDiskID = res.Substring(startI + search.Length).Trim();
}
return currentDiskID;
}
public static string ExecuteCommandSync(object command)
{
try
{
System.Diagnostics.ProcessStartInfo procStartInfo =
new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command);
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
procStartInfo.CreateNoWindow = true;
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = procStartInfo;
proc.Start();
string result = proc.StandardOutput.ReadToEnd();
return result;
}
catch (Exception)
{
return null;
}
}
Reply
Answers (
0
)
access value of dynamically created textbox in grid
Custom WebControl