{"id":358373,"date":"2024-05-21T00:10:28","date_gmt":"2024-05-21T00:10:28","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=358373"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=358373","title":{"rendered":"<span>VBA, Windows 10: \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u044f \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0441 \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438 \u043f\u0443\u0442\u044f\u043c\u0438<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041d\u0435\u0434\u0430\u0432\u043d\u043e, \u0440\u0430\u0431\u043e\u0442\u0430\u044f \u0432 VBA, \u044f \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0443 \u0444\u0430\u0439\u043b\u043e\u0432, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0432 \u0434\u043b\u0438\u043d\u043d\u044b\u0445, \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f\u0445. \u041d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u043b\u0438 \u044d\u0442\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c. \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0432 Windows 10 (\u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0432 \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445) \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u043b\u0438\u043d\u0443 \u043f\u0443\u0442\u0435\u0439 (\u0441\u043c., \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 <a href=\"https:\/\/learn.microsoft.com\/ru-ru\/windows\/win32\/fileio\/maximum-file-path-limitation?tabs=registry\" rel=\"noopener noreferrer nofollow\">https:\/\/learn.microsoft.com\/ru-ru\/windows\/win32\/fileio\/maximum-file-path-limitation?tabs=registry<\/a>). \u0420\u0435\u0448\u0435\u043d\u0438\u044f, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0435 \u043f\u0440\u0438\u043d\u0435\u0441\u043b\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430. \u0414\u0430, \u0434\u043b\u044f \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438 \u043f\u0443\u0442\u044f\u043c\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0438\u0445 \u0432 \u0440\u0435\u0435\u0441\u0442\u0440\u0435 ( \u0440\u0430\u0437\u0434\u0435\u043b <code>Computer\\HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem\\LongPathsEnabled (Type: REG_DWORD)<\/code> \u0440\u0435\u0435\u0441\u0442\u0440\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0438 \u0438\u043c\u0435\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 1), \u043d\u043e \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u044b, \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b \u0438\u043c\u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435, \u0442.\u043a. \u0441\u0430\u043c \u043f\u0440\u043e\u0432\u043e\u0434\u043d\u0438\u043a Windows \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438 \u043f\u0443\u0442\u044f\u043c\u0438. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0441\u043a\u0440\u0438\u043f\u0442 VBA, \u043f\u0440\u0438 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0440\u043e\u0432\u043e\u0434\u043d\u0438\u043a Windows. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0441 \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438 \u043f\u0443\u0442\u044f\u043c\u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u043e\u0432\u043e\u0434\u043d\u0438\u043a 7-Zip File Manager, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u043d \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a &#8212; \u0435\u0433\u043e \u043b\u0435\u0433\u043a\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c.<\/p>\n<p>\u0412\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0438\u0434\u0435\u044f \u043e\u0431\u043e\u0439\u0442\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f Windows \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u043e\u0432\u043e\u0434\u043d\u0438\u043a 7-Zip File Manager. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438 \u043f\u0443\u0442\u044f\u043c\u0438.<\/p>\n<pre><code class=\"vbscript\">'\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438 \u043f\u0443\u0442\u044f\u043c\u0438 Public Sub Per_Files()  Dim sDir As String, dDir As String, old_name As String, new_name As String     sDir = \"C:\\1\\\" '\u0418\u0441\u0445\u043e\u0434\u043d\u0430\u044f \u043f\u0430\u043f\u043a\u0430\"    dDir = \"C:\\2\\\" '\u0426\u0435\u043b\u0435\u0432\u0430\u044f \u043f\u0430\u043f\u043a\u0430         old_name = \"1.pdf\" '\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b: \u0441\u0442\u0430\u0440\u043e\u0435 \u0438\u043c\u044f    new_name = \"1-1.pdf\" '\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b: \u043d\u043e\u0432\u043e\u0435 \u0438\u043c\u044f  Call cp7z(sDir, dDir, old_name, new_name)  End Sub  '\u041f\u043e\u0434\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438 \u043f\u0443\u0442\u044f\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0440\u0445\u0438\u0432\u0430\u0442\u043e\u0440\u0430 7z Public Sub cp7z(ByVal sDir As String, ByVal dDir As String, ByVal oldFile As String, ByVal nFile As String)  Dim PrDir As String, tDir As String, comstr As String      PrDir = \"\"\"C:\\Program Files\\7-Zip\\7z.exe\"\"\" '\u0420\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 7z     tDir = \"C:\\tmp\\tmp.7z\" '\u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043f\u0430\u043f\u043a\u0430 \u0438 \u0444\u0430\u0439\u043b          '\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430 tmp.7z. \u0415\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u0444\u0430\u0439\u043b \u0435\u0441\u0442\u044c - \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u043e\u0435 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0435 \u0438\u043c\u044f     Do While Dir(tDir) &lt;> \"\"         tDir = \"C:\\tmp\\\" &amp; WorksheetFunction.RandBetween(1, 1000) &amp; \"tmp.7z\" '        MsgBox tDir     Loop      '\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0430\u0440\u0445\u0438\u0432\u0430 C:\\tmp\\*tmp.7z \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0441 \u0434\u043b\u0438\u043d\u043d\u044b\u043c \u043f\u0443\u0442\u0451\u043c (\u0431\u0435\u0437 \u043a\u043e\u043c\u043f\u0440\u0435\u0441\u0441\u0438\u0438, \u0442.\u0435. \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u0444\u0430\u0439\u043b *tmp.7z)     comstr = PrDir &amp; \" a -mx0 \" &amp; tDir &amp; \" \" &amp; Chr(34) &amp; sDir &amp; oldFile &amp; Chr(34)     Debug.Print comstr     ShellAndWait comstr          '\u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0432 \u0430\u0440\u0445\u0438\u0432\u0435 C:\\tmp\\*tmp.7z \u0441\u0442\u0430\u0440\u043e\u0435 \u0438\u043c\u044f -> \u043d\u043e\u0432\u043e\u0435 \u0438\u043c\u044f     comstr = PrDir &amp; \" rn \" &amp; tDir &amp; \" \" &amp; Chr(34) &amp; oldFile &amp; Chr(34) &amp; _               \" \" &amp; Chr(34) &amp; nFile &amp; Chr(34)      Debug.Print comstr     ShellAndWait comstr      '\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0438\u0437 \u0430\u0440\u0445\u0438\u0432\u0430 C:\\tmp\\*tmp.7z \u0432 \u0446\u0435\u043b\u0435\u0432\u0443\u044e \u043f\u0430\u043f\u043a\u0443     comstr = PrDir &amp; \" e -y \" &amp; tDir &amp; \" -o\" &amp; Chr(34) &amp; dDir &amp; Chr(34)     Debug.Print comstr     ShellAndWait comstr      '\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430     Kill tDir  End Sub  '\u041f\u043e\u0434\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 7z \u0441 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 Sub ShellAndWait(pathFile As String) Dim WshShell As Object     Set WshShell = CreateObject(\"Wscript.Shell\")     WshShell.Run pathFile, 0, True '\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e True, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c\u0441\u044f,   '\u0438\u043d\u0430\u0447\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0430\u0447\u043d\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0440\u0430\u043d\u044c\u0448\u0435 \u0441\u0440\u043e\u043a\u0430 \u0438 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c End Sub<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0444\u0430\u0439\u043b \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0430\u0440\u0445\u0438\u0432\u0430\u0442\u043e\u0440\u043e\u043c 7z \u0432\u043e \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b (\u0431\u0435\u0437 \u0441\u0436\u0430\u0442\u0438\u044f), \u0430 \u0437\u0430\u0442\u0435\u043c \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b \u043f\u043e \u043d\u043e\u0432\u043e\u043c\u0443 \u043f\u0443\u0442\u0438. \u0412\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0435, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0438 \u0446\u0435\u043b\u0435\u0432\u044b\u0445 \u043f\u0430\u043f\u043e\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043f\u0430\u043f\u043a\u0438 &#171;C:\\1\\&#187; \u0438 &#171;C:\\2\\&#187;, \u043d\u043e \u0432 \u0432\u0430\u0448\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0443\u0442\u0438 (\u0432 \u0432\u0438\u0434\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 string) \u043b\u044e\u0431\u043e\u0439 \u0434\u043b\u0438\u043d\u044b \u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 + \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f, \u0441\u043b\u0435\u0433\u043a\u0430 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0432 \u0441\u043a\u0440\u0438\u043f\u0442 (\u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430).<\/p>\n<p>\u0418 \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435, \u0447\u0442\u043e \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u0443 \u0432\u0430\u0441 \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0430\u0440\u0445\u0438\u0432\u0430\u0442\u043e\u0440 7z \u0438 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u043a \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443 \u0430\u0440\u0445\u0438\u0432\u0430\u0442\u043e\u0440\u0430 (\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f PrDir).<\/p>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0442\u043e\u0440\u043e\u0432, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c <a class=\"mention\" href=\"\/users\/b13nerd\">@B13nerd<\/a>\u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b \u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u043a\u043e\u0434, \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0435\u043c\u0443 \u0441\u043f\u0430\u0441\u0438\u0431\u043e!<\/p>\n<pre><code class=\"vbscript\">Option Explicit  Private Enum BOOL   FALSE_BOOL = 0   TRUE_BOOL = 1 End Enum  'BOOL CopyFile( '  [in] LPCTSTR lpExistingFileName, '  [in] LPCTSTR lpNewFileName, '  [in] BOOL    bFailIfExists '); Private Declare PtrSafe Function CopyFile Lib \"kernel32\" Alias \"CopyFileW\" ( _   ByVal sExistingFileName As LongPtr, _   ByVal sNewFileName As LongPtr, _   ByVal bFailIfExists As BOOL) As BOOL  Private Const MAX_PATH As Long = 260  Private Sub MakeLongFileName(ByRef sFileName As String)   Const PREFIX As String = \"\\\\?\\\"   Const PREFIX_LEN As Long = 4   If Len(sFileName) >= MAX_PATH Then     If StrComp(Left$(sFileName, PREFIX_LEN), PREFIX) Then       sFileName = PREFIX &amp; sFileName     End If   End If End Sub  Public Function MyCopyFile( _   ByVal sExistingFileName As String, _   ByVal sNewFileName As String) As Long      MakeLongFileName sExistingFileName   MakeLongFileName sNewFileName      CopyFile StrPtr(sExistingFileName), StrPtr(sNewFileName), TRUE_BOOL   MyCopyFile = Err.LastDllError '0 - Ok, 3 - \u043f\u0443\u0442\u044c \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d, 80 - \u0444\u0430\u0439\u043b \u0441 \u0442\u0430\u043a\u0438\u043c \u0438\u043c\u0435\u043d\u0435\u043c \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 End Function  Public Sub Test1()   Dim sSrcPath As String   sSrcPath = \"D:\\Doc\\source.ext\" '\u0444\u0430\u0439\u043b - \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0434\u043b\u0438\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c   Dim sDstPath As String   '\u0444\u0430\u0439\u043b \u0446\u0435\u043b\u044c, \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u0434\u043b\u0438\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c   sDstPath = \"D:\\Download\\\" &amp; _     \"ajdhjfkwofnwdiowdkncionioweudnmnspcjwpjedpjqpsdmpqlmsdpmnohfoqpwdsmnondoqhodhoq\\\" &amp; _     \"kmedfopqmpsmxcopmndcoibnoqwdqpmsdcppxinqionwedonqpwdmpmpmpqnowidiqdnpmnqpwdpqnw\\\" &amp; _     \"mcwmnediqncniqnwondonqnwdpqjwodjpqjwddiondnnq23ejnwqdnqowjdndxnqowndioqnwid\\\" &amp; _     \"qknmwdqinwod89wndkqn892dnkqnd89qhd8qwndilqndqw89dhqonwdnqklnwdlq8wjhdqwdklmnqiw\\\" &amp; _     \"destination.ext\"   Debug.Print MyCopyFile(sSrcPath, sDstPath) End Sub<\/code><\/pre>\n<p> \u0426\u0435\u043b\u0435\u0432\u0430\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c, \u0442.\u0435. \u043f\u0435\u0440\u0435\u0434 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u044f\u043c\u0438 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c \u0447\u0442\u043e \u0446\u0435\u043b\u0435\u0432\u0430\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u0430 \u0435\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e\u0433\u0434\u0430 \u043d\u0430\u0434\u043e \u0435\u0451 \u0441\u043e\u0437\u0434\u0430\u0442\u044c.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/769650\/\"> https:\/\/habr.com\/ru\/articles\/769650\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041d\u0435\u0434\u0430\u0432\u043d\u043e, \u0440\u0430\u0431\u043e\u0442\u0430\u044f \u0432 VBA, \u044f \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0443 \u0444\u0430\u0439\u043b\u043e\u0432, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0432 \u0434\u043b\u0438\u043d\u043d\u044b\u0445, \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f\u0445. \u041d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u043b\u0438 \u044d\u0442\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c. \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0432 Windows 10 (\u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0432 \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445) \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u043b\u0438\u043d\u0443 \u043f\u0443\u0442\u0435\u0439 (\u0441\u043c., \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 <a href=\"https:\/\/learn.microsoft.com\/ru-ru\/windows\/win32\/fileio\/maximum-file-path-limitation?tabs=registry\" rel=\"noopener noreferrer nofollow\">https:\/\/learn.microsoft.com\/ru-ru\/windows\/win32\/fileio\/maximum-file-path-limitation?tabs=registry<\/a>). \u0420\u0435\u0448\u0435\u043d\u0438\u044f, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0435 \u043f\u0440\u0438\u043d\u0435\u0441\u043b\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430. \u0414\u0430, \u0434\u043b\u044f \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438 \u043f\u0443\u0442\u044f\u043c\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0438\u0445 \u0432 \u0440\u0435\u0435\u0441\u0442\u0440\u0435 ( \u0440\u0430\u0437\u0434\u0435\u043b <code>Computer\\HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem\\LongPathsEnabled (Type: REG_DWORD)<\/code> \u0440\u0435\u0435\u0441\u0442\u0440\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0438 \u0438\u043c\u0435\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 1), \u043d\u043e \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u044b, \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b \u0438\u043c\u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435, \u0442.\u043a. \u0441\u0430\u043c \u043f\u0440\u043e\u0432\u043e\u0434\u043d\u0438\u043a Windows \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438 \u043f\u0443\u0442\u044f\u043c\u0438. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0441\u043a\u0440\u0438\u043f\u0442 VBA, \u043f\u0440\u0438 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0440\u043e\u0432\u043e\u0434\u043d\u0438\u043a Windows. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0441 \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438 \u043f\u0443\u0442\u044f\u043c\u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u043e\u0432\u043e\u0434\u043d\u0438\u043a 7-Zip File Manager, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u043d \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a &#8212; \u0435\u0433\u043e \u043b\u0435\u0433\u043a\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c.<\/p>\n<p>\u0412\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0438\u0434\u0435\u044f \u043e\u0431\u043e\u0439\u0442\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f Windows \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u043e\u0432\u043e\u0434\u043d\u0438\u043a 7-Zip File Manager. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438 \u043f\u0443\u0442\u044f\u043c\u0438.<\/p>\n<pre><code class=\"vbscript\">'\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438 \u043f\u0443\u0442\u044f\u043c\u0438 Public Sub Per_Files()  Dim sDir As String, dDir As String, old_name As String, new_name As String     sDir = \"C:\\1\\\" '\u0418\u0441\u0445\u043e\u0434\u043d\u0430\u044f \u043f\u0430\u043f\u043a\u0430\"    dDir = \"C:\\2\\\" '\u0426\u0435\u043b\u0435\u0432\u0430\u044f \u043f\u0430\u043f\u043a\u0430         old_name = \"1.pdf\" '\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b: \u0441\u0442\u0430\u0440\u043e\u0435 \u0438\u043c\u044f    new_name = \"1-1.pdf\" '\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b: \u043d\u043e\u0432\u043e\u0435 \u0438\u043c\u044f  Call cp7z(sDir, dDir, old_name, new_name)  End Sub  '\u041f\u043e\u0434\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438 \u043f\u0443\u0442\u044f\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0440\u0445\u0438\u0432\u0430\u0442\u043e\u0440\u0430 7z Public Sub cp7z(ByVal sDir As String, ByVal dDir As String, ByVal oldFile As String, ByVal nFile As String)  Dim PrDir As String, tDir As String, comstr As String      PrDir = \"\"\"C:\\Program Files\\7-Zip\\7z.exe\"\"\" '\u0420\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 7z     tDir = \"C:\\tmp\\tmp.7z\" '\u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043f\u0430\u043f\u043a\u0430 \u0438 \u0444\u0430\u0439\u043b          '\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430 tmp.7z. \u0415\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u0444\u0430\u0439\u043b \u0435\u0441\u0442\u044c - \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u043e\u0435 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0435 \u0438\u043c\u044f     Do While Dir(tDir) &lt;> \"\"         tDir = \"C:\\tmp\\\" &amp; WorksheetFunction.RandBetween(1, 1000) &amp; \"tmp.7z\" '        MsgBox tDir     Loop      '\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0430\u0440\u0445\u0438\u0432\u0430 C:\\tmp\\*tmp.7z \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0441 \u0434\u043b\u0438\u043d\u043d\u044b\u043c \u043f\u0443\u0442\u0451\u043c (\u0431\u0435\u0437 \u043a\u043e\u043c\u043f\u0440\u0435\u0441\u0441\u0438\u0438, \u0442.\u0435. \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u0444\u0430\u0439\u043b *tmp.7z)     comstr = PrDir &amp; \" a -mx0 \" &amp; tDir &amp; \" \" &amp; Chr(34) &amp; sDir &amp; oldFile &amp; Chr(34)     Debug.Print comstr     ShellAndWait comstr          '\u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0432 \u0430\u0440\u0445\u0438\u0432\u0435 C:\\tmp\\*tmp.7z \u0441\u0442\u0430\u0440\u043e\u0435 \u0438\u043c\u044f -> \u043d\u043e\u0432\u043e\u0435 \u0438\u043c\u044f     comstr = PrDir &amp; \" rn \" &amp; tDir &amp; \" \" &amp; Chr(34) &amp; oldFile &amp; Chr(34) &amp; _               \" \" &amp; Chr(34) &amp; nFile &amp; Chr(34)      Debug.Print comstr     ShellAndWait comstr      '\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0438\u0437 \u0430\u0440\u0445\u0438\u0432\u0430 C:\\tmp\\*tmp.7z \u0432 \u0446\u0435\u043b\u0435\u0432\u0443\u044e \u043f\u0430\u043f\u043a\u0443     comstr = PrDir &amp; \" e -y \" &amp; tDir &amp; \" -o\" &amp; Chr(34) &amp; dDir &amp; Chr(34)     Debug.Print comstr     ShellAndWait comstr      '\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430     Kill tDir  End Sub  '\u041f\u043e\u0434\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 7z \u0441 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 Sub ShellAndWait(pathFile As String) Dim WshShell As Object     Set WshShell = CreateObject(\"Wscript.Shell\")     WshShell.Run pathFile, 0, True '\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e True, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c\u0441\u044f,   '\u0438\u043d\u0430\u0447\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0430\u0447\u043d\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0440\u0430\u043d\u044c\u0448\u0435 \u0441\u0440\u043e\u043a\u0430 \u0438 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c End Sub<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0444\u0430\u0439\u043b \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0430\u0440\u0445\u0438\u0432\u0430\u0442\u043e\u0440\u043e\u043c 7z \u0432\u043e \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b (\u0431\u0435\u0437 \u0441\u0436\u0430\u0442\u0438\u044f), \u0430 \u0437\u0430\u0442\u0435\u043c \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b \u043f\u043e \u043d\u043e\u0432\u043e\u043c\u0443 \u043f\u0443\u0442\u0438. \u0412\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0435, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0438 \u0446\u0435\u043b\u0435\u0432\u044b\u0445 \u043f\u0430\u043f\u043e\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043f\u0430\u043f\u043a\u0438 &#171;C:\\1\\&#187; \u0438 &#171;C:\\2\\&#187;, \u043d\u043e \u0432 \u0432\u0430\u0448\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0443\u0442\u0438 (\u0432 \u0432\u0438\u0434\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 string) \u043b\u044e\u0431\u043e\u0439 \u0434\u043b\u0438\u043d\u044b \u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 + \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f, \u0441\u043b\u0435\u0433\u043a\u0430 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0432 \u0441\u043a\u0440\u0438\u043f\u0442 (\u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430).<\/p>\n<p>\u0418 \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435, \u0447\u0442\u043e \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u0443 \u0432\u0430\u0441 \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0430\u0440\u0445\u0438\u0432\u0430\u0442\u043e\u0440 7z \u0438 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u043a \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443 \u0430\u0440\u0445\u0438\u0432\u0430\u0442\u043e\u0440\u0430 (\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f PrDir).<\/p>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0442\u043e\u0440\u043e\u0432, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c <a class=\"mention\" href=\"\/users\/b13nerd\">@B13nerd<\/a>\u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b \u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u043a\u043e\u0434, \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0435\u043c\u0443 \u0441\u043f\u0430\u0441\u0438\u0431\u043e!<\/p>\n<pre><code class=\"vbscript\">Option Explicit  Private Enum BOOL   FALSE_BOOL = 0   TRUE_BOOL = 1 End Enum  'BOOL CopyFile( '  [in] LPCTSTR lpExistingFileName, '  [in] LPCTSTR lpNewFileName, '  [in] BOOL    bFailIfExists '); Private Declare PtrSafe Function CopyFile Lib \"kernel32\" Alias \"CopyFileW\" ( _   ByVal sExistingFileName As LongPtr, _   ByVal sNewFileName As LongPtr, _   ByVal bFailIfExists As BOOL) As BOOL  Private Const MAX_PATH As Long = 260  Private Sub MakeLongFileName(ByRef sFileName As String)   Const PREFIX As String = \"\\\\?\\\"   Const PREFIX_LEN As Long = 4   If Len(sFileName) >= MAX_PATH Then     If StrComp(Left$(sFileName, PREFIX_LEN), PREFIX) Then       sFileName = PREFIX &amp; sFileName     End If   End If End Sub  Public Function MyCopyFile( _   ByVal sExistingFileName As String, _   ByVal sNewFileName As String) As Long      MakeLongFileName sExistingFileName   MakeLongFileName sNewFileName      CopyFile StrPtr(sExistingFileName), StrPtr(sNewFileName), TRUE_BOOL   MyCopyFile = Err.LastDllError '0 - Ok, 3 - \u043f\u0443\u0442\u044c \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d, 80 - \u0444\u0430\u0439\u043b \u0441 \u0442\u0430\u043a\u0438\u043c \u0438\u043c\u0435\u043d\u0435\u043c \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 End Function  Public Sub Test1()   Dim sSrcPath As String   sSrcPath = \"D:\\Doc\\source.ext\" '\u0444\u0430\u0439\u043b - \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0434\u043b\u0438\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c   Dim sDstPath As String   '\u0444\u0430\u0439\u043b \u0446\u0435\u043b\u044c, \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u0434\u043b\u0438\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c   sDstPath = \"D:\\Download\\\" &amp; _     \"ajdhjfkwofnwdiowdkncionioweudnmnspcjwpjedpjqpsdmpqlmsdpmnohfoqpwdsmnondoqhodhoq\\\" &amp; _     \"kmedfopqmpsmxcopmndcoibnoqwdqpmsdcppxinqionwedonqpwdmpmpmpqnowidiqdnpmnqpwdpqnw\\\" &amp; _     \"mcwmnediqncniqnwondonqnwdpqjwodjpqjwddiondnnq23ejnwqdnqowjdndxnqowndioqnwid\\\" &amp; _     \"qknmwdqinwod89wndkqn892dnkqnd89qhd8qwndilqndqw89dhqonwdnqklnwdlq8wjhdqwdklmnqiw\\\" &amp; _     \"destination.ext\"   Debug.Print MyCopyFile(sSrcPath, sDstPath) End Sub<\/code><\/pre>\n<p> \u0426\u0435\u043b\u0435\u0432\u0430\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c, \u0442.\u0435. \u043f\u0435\u0440\u0435\u0434 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u044f\u043c\u0438 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c \u0447\u0442\u043e \u0446\u0435\u043b\u0435\u0432\u0430\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u0430 \u0435\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e\u0433\u0434\u0430 \u043d\u0430\u0434\u043e \u0435\u0451 \u0441\u043e\u0437\u0434\u0430\u0442\u044c.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/769650\/\"> https:\/\/habr.com\/ru\/articles\/769650\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-358373","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/358373","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=358373"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/358373\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=358373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=358373"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=358373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}