GokAy Posted November 2, 2020 Share Posted November 2, 2020 (edited) Yes, forgot about that one Edited that post. Thanks Edited that post again, first one was made hastily. Final edited part is: Local $sCMD = @comspec & " /c copy /y """ & @ScriptDir & "\test.bat"" ""d:\""" @Jos, also added double quotes to destination. Edited November 2, 2020 by GokAy Link to comment Share on other sites More sharing options...
DirtyJohny Posted November 2, 2020 Author Share Posted November 2, 2020 (edited) Its f*cking stupid ,but i write and they working... Edited November 2, 2020 by DirtyJohny Link to comment Share on other sites More sharing options...
GokAy Posted November 2, 2020 Share Posted November 2, 2020 Nice, I guess that was the first thing that was suggested? 😛 Put double-quotes around the source and destination paths for a more robust code, in case you have to have spaces in either a folder or file name in the future. Link to comment Share on other sites More sharing options...
caramen Posted November 2, 2020 Share Posted November 2, 2020 (edited) This is what I use for PsExec script using Robocopy. I'm afraid to implement complex things. Copy : $iResult = Run ( @ComSpec & ' /c robocopy "'&@ScriptDir&'\Data\Source1" "\\'&$PSEXEC1_3_1&'\c$\temptest" /E /R:2', _ @SystemDir , _ @SW_HIDE , _ BitOR($STDERR_CHILD, $STDOUT_CHILD) ) If @error <> 0 Then MsgBox(16, "Erreur lancement cmd 1", "Erreur: @error = " & @error & ", @extended: " & @extended) $sOutput = '' While 1 Sleep(10) $sOutput &= StderrRead($iResult) If @error Then ; Exit the loop if the process closes or StderrRead returns an error. ExitLoop EndIf ;~ ConsoleWrite ("Install : "&$sOutput ) WEnd ProcessWaitClose($iResult) $sOutput = StdoutRead($iResult) $aArray = StringSplit(StringTrimRight(StringStripCR($sOutput), StringLen(@CRLF)), @CRLF) $OffsetLocal = Ubound ($aArray) For $i = 0 To $OffsetLocal - 1 Step 1 $aArray[$i] = StringReplace ($aArray[$i] , "ÿ" , " " ) $aArray[$i] = StringReplace ($aArray[$i] , "‚" , "é" ) $aArray[$i] = StringReplace ($aArray[$i] , "Š" , "è" ) ConsoleWrite ( $aArray [$i]&@CRLF) Next Execute : $iResult = Run ( @ComSpec & ' /c PSEXEC \\'&$PSEXEC1_3_1&' -u '&$PSEXEC1_0_1&' -p '&$PSEXEC1_1_1&' -i -s -d "c:\temptest\Hello.exe"', _ @SystemDir, _ @SW_HIDE , _ BitOR($STDERR_CHILD, $STDOUT_CHILD) ) If @error <> 0 Then MsgBox(16, "Erreur lancement cmd 2", "Erreur: @error = " & @error & ", @extended: " & @extended ) $sOutput = "" While 1 Sleep(10) $sOutput &= StderrRead($iResult) If @error Then ; Exit the loop if the process closes or StderrRead returns an error. ExitLoop EndIf ;~ GUICtrlSetData( $PSEXEC1_L_2 , "Install : "&$sOutput ) WEnd $aArray = StringSplit(StringTrimRight(StringStripCR($sOutput), StringLen(@CRLF)), @CRLF) If @error Then ConsoleWrite("L'installation n'a pas été effectuée.") Else $OffsetLocal = Ubound ($aArray) $OffsetLocal -= 1 For $i = 0 To $OffsetLocal Step 1 $aArray[$i] = StringReplace ($aArray[$i] , "ÿ" , " " ) $aArray[$i] = StringReplace ($aArray[$i] , "‚" , "é" ) $aArray[$i] = StringReplace ($aArray[$i] , "Š" , "è" ) ConsoleWrite ( $aArray [$i]&@CRLF) Next EndIf To be sure it's waiting and getting the string return value I use the StderrRead in a Loop as suggested by help file or with process wait. Edited November 2, 2020 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
Developers Jos Posted November 2, 2020 Developers Share Posted November 2, 2020 7 minutes ago, DirtyJohny said: Its f*cking stupid ,but i write and they working... Did you move your script to another subdirectory? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
DirtyJohny Posted November 2, 2020 Author Share Posted November 2, 2020 No I delete consolewrite and write run Link to comment Share on other sites More sharing options...
Developers Jos Posted November 2, 2020 Developers Share Posted November 2, 2020 So what is the exact directory of the script? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
DirtyJohny Posted November 2, 2020 Author Share Posted November 2, 2020 3 hours ago, DirtyJohny said: expandcollapse popup#include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> #include <String.au3> # include <Crypt.au3> #include <WinAPISysWin.au3> #include <FileConstants.au3> #RequireAdmin #NoTrayIcon ; Все что написано, посде ";" явлется комментарийрием и ни как не влияет на работу скрипта. Глобальный $ rMyName , $ rHostName ; объявляем переменные, которые будут объявить в цикле $ Main = GUICreate ( 'Логус от ДиДжо' , 282 , 88 , 318 , 213 ) ; рисуем главное окно GUISetBkColor ( 0x000000 ) $ iHostName = GUICtrlCreateInput ( "10.253.13.13" , 5 , 20 , 272 , 21 ) ; создаем поле ввода для имени пк $ iConnect = GUICtrlCreateButton ( "GO" , 8 , 50 , 267, 33 , $ BS _ DEFPUSHBUTTON ) ; создаем кнопку подключения GUICtrlSetFont ( - 1 , 8 , 800 , 0 , «Тахома» ) ; задаем стиль элементу выше GUICtrlSetColor ( - 1 , 0xFFFFFF ) GUICtrlSetBkColor ( - 1 , 0x545454 ) GUICtrlSetFont ( - 1 , 8 , 800 , 0 , «Тахома» ); задаем стиль элементу выше GUISetState ( @SW_SHOW ) Func _ hide ( ) ; функция. отключает элементы ввода и кнопку, пока работает скрипт GUICtrlSetState ( $ iConnect , $ GUI _ disable ) GUICtrlSetState ( $ iHostName , $ GUI _ disable ) EndFunc Func _ show ( ) ; функция. включает элементы ввода и кнопку, когда скрипт отработал GUICtrlSetState ( $ iConnect , $ GUI _ enable ) GUICtrlSetState ( $ iHostName , $ GUI _ enable ) EndFunc В то время как 1 ; создаем цикл, который работает постоянно и отслеживает разъемие кнопок Переключить GUIGetMsg ( ) Кейс $ GUI _ СОБЫТИЕ _ ЗАКРЫТЬ ; на "крестик" ExitLoop ; выходит из цикла и закрывает окно Кейс $ iConnect ; нажиматие нашей единственной кнопки $ rHostName = GUICtrlRead ( $ iHostName ) ; считывает поле ввода HostName, в переменную Если $ rHostName = "" Тогда; защита от пустого поля логина MsgBox ( 16 + 8192 + 262144 , «Ошибка» , «Поле HostName - пустое» ) Еще _ hide ( ) ; отключает все элементы ввода и кнопку ConsoleWrite ( @ComSpec & '/ c copy / y' & @ScriptDir & '\ LOGUS \ Logus.bat \\' & $ rHostName & '\ C $' ) _ показать ( ) ; включает все элементы ввода и кнопку Конец Если EndSwitch ВЕНД Yes, just rewrite Consolewrite->RunWait) Link to comment Share on other sites More sharing options...
Developers Jos Posted November 2, 2020 Developers Share Posted November 2, 2020 I understand there is a language challenge, but this is not the answer to my question: 10 minutes ago, Jos said: So what is the exact directory of the script? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
DirtyJohny Posted November 2, 2020 Author Share Posted November 2, 2020 1 hour ago, GokAy said: Хорошо, я думаю, это было первое, что было предложено? 😛 Заключите исходный и целевой пути в двойные кавычки для более надежного кода на случай, если в будущем вам понадобятся пробелы в имени папки или файла. Y mean that?) Run(@ComSpec & ' /c copy /y "' & @ScriptDir & '\LOGUS\Logus.bat" \\' & $rHostName & '\C$') Link to comment Share on other sites More sharing options...
Developers Jos Posted November 2, 2020 Developers Share Posted November 2, 2020 I give up ... sorry. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
DirtyJohny Posted November 2, 2020 Author Share Posted November 2, 2020 2 minutes ago, Jos said: I understand there is a language challenge, but this is not the answer to my question: Any directory. I start my script in any directory and his working) Link to comment Share on other sites More sharing options...
DirtyJohny Posted November 2, 2020 Author Share Posted November 2, 2020 2 minutes ago, Jos said: I give up ... sorry. Man, be easy.All working, thanks you all) Link to comment Share on other sites More sharing options...
caramen Posted November 2, 2020 Share Posted November 2, 2020 We couldn't help you if you don't do suggestion or if you don't answer to our questions. We want to help you but, we can't. You don't let us. Мы не сможем вам помочь, если вы не сделаете предложения или не ответите на наши вопросы. Мы хотим помочь вам, но не можем. Вы не позволяете нам. You see I'm not Russian but I can talk Russian using https://translate.google.fr/ . If you don't understand just do the same. Видите ли, я не русский, но я могу говорить по-русски, используя https://translate.google.fr/. Если вы не понимаете, просто сделайте то же самое. My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now