Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

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

Ветеран


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

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


Пробуйте (без проверок):
Скрытый текст
Код: Выделить весь код
Option Explicit

Dim strSourceFile


With WScript.CreateObject("Scripting.FileSystemObject")
	strSourceFile = Trim(InputBox("Enter file name:", "Enter file name", .GetAbsolutePathName(GetLocalDate() & ".txt")))
	
	If Not .FileExists(strSourceFile) Then
		.CreateTextFile(strSourceFile).Close
		WScript.CreateObject("Shell.Application").NameSpace(.GetParentFolderName(strSourceFile)).ParseName(.GetFileName(strSourceFile)).InvokeVerb "open"
	End If
End With

WScript.Quit 0

Function GetLocalDate()
	Dim objSWbemObjectEx
	
	For Each objSWbemObjectEx In WScript.CreateObject("WbemScripting.SWbemLocator").ConnectServer(".", "root\cimv2").ExecQuery("SELECT LocalDateTime FROM Win32_OperatingSystem WHERE Primary = 'True'")
		GetLocalDate = Left(objSWbemObjectEx.LocalDateTime, 8)
		
		Exit For
	Next
End Function

Отправлено: 23:42, 01-10-2019 | #4