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

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

Ветеран


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

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


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

Dim strSourceObject
Dim strSourceFolder
Dim strSourceFile

Dim strDestObject


If WScript.Arguments.Count = 1 Then
	With WScript.CreateObject("Scripting.FileSystemObject")
		strSourceObject = .GetAbsolutePathName(WScript.Arguments.Item(0))
		
		If .FolderExists(strSourceObject) Then
			strSourceFolder = strSourceObject
			
			strDestObject = Trim(WScript.CreateObject("htmlfile").parentWindow.clipboardData.getData("text"))
			
			If Len(strDestObject) > 0 Then
				If Not StrComp(strSourceFolder, strDestObject, vbTextCompare) = 0 Then
					.MoveFolder strSourceFolder, strDestObject
				Else
					WScript.Echo "Need new name of folder."
					WScript.Quit 4
				End If
			Else
				WScript.Echo "User cancel input."
				WScript.Quit 3
			End If
		ElseIf .FileExists(strSourceObject) Then
			strSourceFile = strSourceObject
			
			strDestObject = Trim(WScript.CreateObject("htmlfile").parentWindow.clipboardData.getData("text"))
			
			If Len(strDestObject) > 0 Then
				If Not StrComp(strSourceFile, strDestObject, vbTextCompare) = 0 Then
					.MoveFile strSourceFile, strDestObject
				Else
					WScript.Echo "Need new name of file."
					WScript.Quit 4
				End If
			Else
				WScript.Echo "User cancel input."
				WScript.Quit 3
			End If
		Else
			WScript.Echo "Can't find source file system object [" & WScript.Arguments.Item(0) & "]."
			WScript.Quit 2
		End If
	End With
Else
	WScript.Echo "Usage: wscript.exe """ & WScript.ScriptName & """ <Source file system object>"
	WScript.Quit 1
End If

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

Отправлено: 19:12, 13-01-2019 | #24