Jump to content

İşletim Sistemine Göre Dosya Çalıştırma


byhabit
 Share

Recommended Posts

arkadaşlar elimde üç adet exe dosyası var var

windows xp için xp.exe

win7 x86 için win7.exe

win7 x64 için win7x64.exe

isimlerinde üç adet dosya

bunları işletim sistemini algılayıp sistem türüne göre çalıştırabilirmiyim 

ve hangi dosyayı kurduğunu kurulum bitince bilgi mesajı olarak veridirebilirmiyim.

amacım hepsini tek bir exe yapmak

Link to comment
Share on other sites

 

Örnek proje:

https://app.box.com/s/5fweq2dxd92ptybkdmgs

ben beceremedim herhalde dosyayı çalıştıramıyorum ve ayrıca xp için ayrı nasıl yaparım xp.exe de win7 de çalışmayan ayarlar var

dosya yolunu bu şekilde yazdım.

 

os = System.GetOSName();
 
if not System.Is64BitOS() then
arch = "x86"
result = File.Install("AutoPlay\\Docs\\win7x86.exe", FILE_INSTALL_SAMEOLDER, false, false, nil, nil);
 
else
arch = "x64"
result = File.Install("AutoPlay\\Docs\\win7x64.exe", FILE_INSTALL_SAMEOLDER, false, false, nil, nil);
end
Edited by byhabit
Link to comment
Share on other sites

Butona falan ekliceksen ;
 
On Click :

[codeh]
tBit = Folder.DoesExist("C:\\Program Files (x86)");
os = System.GetOSName();
if os == "Windows XP" then
File.Run(_SourceFolder.."xp.exe", "", "", SW_SHOWNORMAL, false);
elseif os == "Windows 7" then
File.Run(_SourceFolder.."win7.exe", "", "", SW_SHOWNORMAL, false);
elseif os == "Windows 7" and tBit then
File.Run(_SourceFolder.."win7x64.exe", "", "", SW_SHOWNORMAL, false);
else
Dialog.Message("HATA", "Sistem Bilgisi Alınamadı !");
end

[/codeh]
 
Bu arada _SourceFolder çalıştırılan programının bulunduğu dosya.
 
Benim aklıma bu geliyor umarım doğrudur.

Edited by HalilYanar
Link to comment
Share on other sites

Sürücü harfi her sistemde aynı değildir.

tBit = Folder.DoesExist("C:\\Program Files (x86)");

yerine

tBit = Folder.DoesExist(_ProgramFilesFolder);

kullanmak daha doğru olacaktır. System.GetOsName() fonksiyonu ile de işletim sisteminin 64 bit olup olmadığının kontrol edilebileceğini hatırlatayım.

Edited by reyiz
Link to comment
Share on other sites

Butona falan ekliceksen ;
 
On Click :

[codeh]
tBit = Folder.DoesExist("C:\\Program Files (x86)");
os = System.GetOSName();
if os == "Windows XP" then
File.Run(_SourceFolder.."xp.exe", "", "", SW_SHOWNORMAL, false);
elseif os == "Windows 7" then
File.Run(_SourceFolder.."win7.exe", "", "", SW_SHOWNORMAL, false);
elseif os == "Windows 7" and tBit then
File.Run(_SourceFolder.."win7x64.exe", "", "", SW_SHOWNORMAL, false);
else
Dialog.Message("HATA", "Sistem Bilgisi Alınamadı !");
end

[/codeh]
 
Bu arada _SourceFolder çalıştırılan programının bulunduğu dosya.
 
Benim aklıma bu geliyor umarım doğrudur.

üzgünüm dosyaları bundada açmadı SourceFolder den eminmisin?

benim çok bilgim yok ams de ilk denemeler yani :)

Link to comment
Share on other sites

Programların adının başına \\ ekleyin.

 

   File.Run(_SourceFolder.."win7.exe", "", "", SW_SHOWNORMAL, false);

 

değil

 

   File.Run(_SourceFolder.."\\win7.exe", "", "", SW_SHOWNORMAL, false);

Edited by reyiz
Link to comment
Share on other sites

Programların adının başına \\ ekleyin.

 

   File.Run(_SourceFolder.."win7.exe", "", "", SW_SHOWNORMAL, false);

 

değil

 

   File.Run(_SourceFolder.."\\win7.exe", "", "", SW_SHOWNORMAL, false);

Hatanın nerde olduğunu anlamadım Buton'un OnClik evresine bu kodları yazdım ama dosyaların hiçbirini çalıştırmıyor

 
tBit = Folder.DoesExist("C:\\Program Files (x86)");
 
os = System.GetOSName();
 
if os == "Windows XP" then
 
File.Run(_SourceFolder.."\\xp.exe", "", "", SW_SHOWNORMAL, false);
 
elseif os == "Windows 7" then
 
File.Run(_SourceFolder.."\\win7.exe", "", "", SW_SHOWNORMAL, false);
 
elseif os == "Windows 7" and tBit then
 
result = File.Run(_SourceFolder.."\\win7x64.exe", "", "", SW_SHOWNORMAL, false);
 
else
 
Dialog.Message("HATA", "Sistem Bilgisi Alınamadı !");
 
end
Edited by byhabit
Link to comment
Share on other sites

Sürücü harfi her sistemde aynı değildir.

tBit = Folder.DoesExist("C:\\Program Files (x86)");

yerine

tBit = Folder.DoesExist(_ProgramFilesFolder);

kullanmak daha doğru olacaktır. System.GetOsName() fonksiyonu ile de işletim sisteminin 64 bit olup olmadığının kontrol edilebileceğini hatırlatayım.

 

_ProgramFilesFolder her bilgisayarda illaki bir klasöre denk geleceğinden hiçbir anlamı olmayacaktır. System.Is64BitOS() en sağlam yöntem olacaktır.

Link to comment
Share on other sites

 

_ProgramFilesFolder her bilgisayarda illaki bir klasöre denk geleceğinden hiçbir anlamı olmayacaktır. System.Is64BitOS() en sağlam yöntem olacaktır.

Bir örnek verebilirmisin?

benim kullandığım sistem win7x64 

butona tıklayınca ilgili dosyayı açmıyor

Link to comment
Share on other sites

Şu anda bilgisayarda AMS yok. Ezbere yazıyorum, yanlışlıklar olabilir.

os = System.GetOSName();
if os == "Windows XP" then
File.Run(_SourceFolder.."\\XP.exe", "", "", SW_SHOWNORMAL, false);
elseif os == "Windows 7" then
If not System.Is64BitOS() then
File.Run(_SourceFolder.."\\x86.exe", "", "", SW_SHOWNORMAL, false);
else
File.Run(_SourceFolder.."\\x64.exe", "", "", SW_SHOWNORMAL, false);
end
end
Link to comment
Share on other sites

Kodu deneyip denemediğimi nereden biliyorsun. Denemiştim ve hata vermemişti. Bu yüzden açıklama yazmamıştım.

 

Bana açıklama yapmadığım için değil, kodu denemediğim için kızmıştınız. Bu sizi haklı çıkarmıyor.

Link to comment
Share on other sites

 

Şu anda bilgisayarda AMS yok. Ezbere yazıyorum, yanlışlıklar olabilir.

os = System.GetOSName();
if os == "Windows XP" then
File.Run(_SourceFolder.."\\XP.exe", "", "", SW_SHOWNORMAL, false);
elseif os == "Windows 7" then
If not System.Is64BitOS() then
File.Run(_SourceFolder.."\\x86.exe", "", "", SW_SHOWNORMAL, false);
else
File.Run(_SourceFolder.."\\x64.exe", "", "", SW_SHOWNORMAL, false);
end
end

bu hatayı veriyor.

http://m1308.hizliresim.com/1d/r/rtjdk.jpg

Link to comment
Share on other sites

If yerine küçük harflerle if yazmayı denermisiniz ?

denedim hata vermedi bu sefer

ama doyaları açmıyor sorun bende sanırım ilgili exe'leri şu dizine atıyorum doğru değilmi?

C:\Users\Aytek\Documents\AutoPlay Media Studio 8\Projects\Ayar\CD_Root\AutoPlay\Docs

Link to comment
Share on other sites

Bir Sorum daha olucak

buton'a eklediğim bu komutlarda çalıştırılan her bir exe'nin kurulumu bitince Dialog message ile işlem tamamlanmıştır mesajı verdirebilirmiyim.

 

os = System.GetOSName();
if os == "Windows XP" then
File.Run(_SourceFolder.."\\XP.exe", "", "", SW_SHOWNORMAL, false);
elseif os == "Windows 7" then
if not System.Is64BitOS() then
File.Run(_SourceFolder.."\\x86.exe", "", "", SW_SHOWNORMAL, false);
else
File.Run(_SourceFolder.."\\x64.exe", "", "", SW_SHOWNORMAL, false);
end
end
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...