-2
我需要更改我的筆記本電腦與Windows 10使用C#的日期。當我使用Windows 7時,我已經在C#中創建了一個應用程序,並且它完美運行,但它不再有效,所以我不得不做一些調整。我目前正在以管理員身份運行該應用程序,並已自動關閉設置時間,但仍無效。這裏是我的代碼:更改窗口10日期與C#
void setDate(string dateInYourSystemFormat) {
var proc = new System.Diagnostics.ProcessStartInfo();
proc.UseShellExecute = true;
proc.WorkingDirectory = @"C:\Windows\System32";
proc.CreateNoWindow = true;
proc.FileName = @"C:\Windows\System32\cmd.exe";
proc.Verb = "runas";
proc.Arguments = "/C date " + dateInYourSystemFormat;
try {
System.Diagnostics.Process.Start(proc);
}
catch {
MessageBox.Show("Error to change time of your system");
Application.ExitThread();
}
}
請幫我在Windows 10中用C#代碼更改日期。
,我從計算器另一張貼此代碼,它說,這是在Windows 8的測試,但我似乎無法使其工作在Windows 10
愚蠢的問題。什麼.net版本是你的應用程序,你有這個.net版本安裝在新的Windows 10筆記本電腦上?另外,你看到了什麼錯誤? – Ethilium
我使用的是.Net Framework 4.5,沒有錯誤,只是執行而沒有任何反應。我已經有了這個.Net Framework,因爲它包含在Windows 10中,我已經嘗試過安裝它,並且我收到了這個消息。 – user1905507
這可以在我的機器上使用此調用: setDate(「2017/4/22」); –