Имя пользователя:
Пароль:
 

Показать сообщение отдельно

Ветеран


Сообщения: 27449
Благодарности: 8088

Профиль | Отправить PM | Цитировать


fisfer, попробуйте так:
Скрытый текст
Код: Выделить весь код
Option Explicit

Dim objSWbemObjectEx
Dim strPath


With WScript.CreateObject("WbemScripting.SWbemLocator").ConnectServer(".", "root\cimv2")
	For Each objSWbemObjectEx In .ExecQuery("SELECT AddressWidth FROM Win32_Processor")
		With WScript.CreateObject("WScript.Shell")
			If objSWbemObjectEx.AddressWidth = 64 Then
				strPath = .ExpandEnvironmentStrings("%ProgramFiles(x86)%") & "\Elauncher2\game\binaries\x86\Elauncher2.exe"
			Else
				strPath = .ExpandEnvironmentStrings("%ProgramFiles%")      & "\Elauncher2\game\binaries\x86\Elauncher2.exe"
			End If
		End With
		
		Exit For
	Next
	
	If WScript.CreateObject("Scripting.FileSystemObject").FileExists(strPath) Then
		.ExecNotificationQuery( _
			"SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE TargetInstance ISA 'Win32_Process' AND " & _
			"TargetInstance.ExecutablePath = '" & Replace(strPath, "\", "\\") & "'" _
		).NextEvent.TargetInstance.Terminate
	Else
		WScript.Echo "Can't find file [" & strPath & "]."
		WScript.Quit 1
	End If
End With

WScript.Quit 0
Это сообщение посчитали полезным следующие участники:

Отправлено: 19:56, 02-11-2018 | #12