Developers Jos Posted November 2, 2020 Developers Share Posted November 2, 2020 (edited) The 6 minutes ago, DirtyJohny said: C:\Program Files (x86)\DiJo\LOGUS>copy Logus.bat \\2-273-GEMO2\C$ This command is not the same as what you try to do in the script!!!! Make the whole command exactly the same as what you want to do in the script, so including the path to the script and ensure it is working! .. and try to post the Source as is without the translation so it remains a valid source! Jos Edited November 2, 2020 by Jos 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 C:\Program Files (x86)\DiJo>copy /y LOGUS\Logus.bat \\2-273-GEMO2\C$ Скопировано файлов: 1. That? I dont understand, what do you want😅 Link to comment Share on other sites More sharing options...
GokAy Posted November 2, 2020 Share Posted November 2, 2020 (edited) Problem may be in the bat file also. How you start the cmd environment affects stuff. If you run the batch from another location, working dir will change. You may need to put this line at the beginning of the batch file: pushd %~dp0 Maybe just remove the /c at the beginning so you can see the cmd window for output. Disclaimer: just woke up, can be halucinating and imagening things 😛 Edited November 2, 2020 by GokAy Link to comment Share on other sites More sharing options...
Developers Jos Posted November 2, 2020 Developers Share Posted November 2, 2020 1 minute ago, DirtyJohny said: C:\Program Files (x86)\DiJo>copy /y LOGUS\Logus.bat \\2-273-GEMO2\C$ This doesn't contain the RED marked part: copy / y' & @ScriptDir & '\ LOGUS \ Logus.bat \\' & $ rHostName & '\ C $' So I expected to see: C:\Program Files (x86)\DiJo>copy /y c:\the-path\to-the-script\LOGUS\Logus.bat \\2-273-GEMO2\C$ 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 Dont work I already testing in C:\ , Desktop folder and it doesn't work Link to comment Share on other sites More sharing options...
Developers Jos Posted November 2, 2020 Developers Share Posted November 2, 2020 2 minutes ago, GokAy said: Problem may be in the bat file also. Pretty sure the problem is that the sourcepath contains spaces .... just taking the steps so the OP will understand why it isn't working. 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...
Developers Jos Posted November 2, 2020 Developers Share Posted November 2, 2020 (edited) 1 minute ago, DirtyJohny said: Dont work I already testing in C:\ , Desktop folder and it doesn't work Doesn't work means nothing! Show me what doesn't work? Edited November 2, 2020 by Jos 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...
GokAy Posted November 2, 2020 Share Posted November 2, 2020 Btw he is trying to copy the bat and not running it right? Disregard my post if so. Link to comment Share on other sites More sharing options...
DirtyJohny Posted November 2, 2020 Author Share Posted November 2, 2020 (edited) That? C:\Program Files (x86)\DiJo>copy /y C:\Progra~2\DiJo\LOGUS\Logus.bat \\2-273-GEMO2\C$ Скопировано файлов: 1. "What doesn't work?" Dont sending Edited November 2, 2020 by DirtyJohny Link to comment Share on other sites More sharing options...
DirtyJohny Posted November 2, 2020 Author Share Posted November 2, 2020 I dont want use full path.I know, its working.What you want tell me?Its not working in any path.And exactly its not working for me but how we can do this? Link to comment Share on other sites More sharing options...
Developers Jos Posted November 2, 2020 Developers Share Posted November 2, 2020 Ok, what about you stop moving files about and trying something different each time? So is this now the script directory or not? : c:\Program Files (x86)\DiJo\LOGUS And is this the file you want to copy?: Logus.bat In that case this should be the command: copy /y "c:\Program Files (x86)\DiJo\LOGUS\Logus.bat" "\\2-273-GEMO2\C$" 3 minutes ago, DirtyJohny said: I dont want use full path.I know, its working.What you want tell me?Its not working in any path.And exactly its not working for me but how we can do this? I am totally lost what you mean here, but when you use @scriptpath you are using the full path. Again you have to show me the command you want to perform with AutoIt3 which is working. So do that and we can help you, but you haven't produced that yet! Jos 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 (edited) Okay. I have a program and i need use did her portable(Write in the top).Many files sorted into folders and now process : I write host name and send files,bats,folder links on remote computer.Need shorten the path. Edited November 2, 2020 by DirtyJohny 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 command you want to do? Including or excluding the full script path? You really need to start thinking about the correct approach and provide the requested details as I feel like a dentist at this moment! 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...
caramen Posted November 2, 2020 Share Posted November 2, 2020 (edited) 31 minutes ago, GokAy said: Btw he is trying to copy the bat and not running it right? Disregard my post if so. PsExec is MS tool to copy what ever you want where ever you want to run it on the target computer after with your local rights. Or you can do domain rights as well. So I presume, he want to do a copy file, to copy the bat file to run it with psexec after which is very easy when you know how to run cmd. But anyway the copy is useless because psexec can copy alone. But it should work... He do that this way I guess because he want to run the script under other rights. 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...
DirtyJohny Posted November 2, 2020 Author Share Posted November 2, 2020 (edited) Yes, about psexec.I need just copy in script folders.Psexec (copy) is not convenient because it has to wait long time for did comand...And i want use copy(@ScriptDir)they fast did comand...excluding the full script path( 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 (edited) This works for me: Setup: Test files are on R: I can successfully copy "test.bat" to D with this code using double-click starting: ;test comspec.au3 Local $sCMD = @comspec & " /c copy /y """ & @ScriptDir & "\test.bat"" ""d:\""" Run($sCMD) However, calling this very script from another script which is on the desktop using Run() doesn't work. ; test comspec from another location.au3 ShellExecute("""R:\test comspec.a3x""") ; OK. this one works, and copies the file Run("""R:\test comspec.a3x""") ; X. doesn't work I will leave why to the experts Edit: And this is the au3 version Run(@AutoItExe & " ""R:\test comspec.au3""") ; Works Edit2: Added extra double quotes around test.bat path according to Jos' comment below. Edit3: Hopefully final edit, fixed the string for $sCMD Edited November 2, 2020 by GokAy Added "\" after @ScriptDir, previous one worked because copy location is the root. Link to comment Share on other sites More sharing options...
DirtyJohny Posted November 2, 2020 Author Share Posted November 2, 2020 Oh fences) Write full script please) Link to comment Share on other sites More sharing options...
GokAy Posted November 2, 2020 Share Posted November 2, 2020 (edited) Those are the full scripts. I am running the a3x compiled script though. Don't know how to run au3 like this. Edited November 2, 2020 by GokAy Link to comment Share on other sites More sharing options...
GokAy Posted November 2, 2020 Share Posted November 2, 2020 (edited) Edited the post above with code to include a version that runs the "test comspec.au3" insted of a3x. Edited November 2, 2020 by GokAy Link to comment Share on other sites More sharing options...
Developers Jos Posted November 2, 2020 Developers Share Posted November 2, 2020 23 minutes ago, GokAy said: Local $sCMD = @comspec & " /c copy /y " & @ScriptDir & "\test.bat d:\" Thought I already made a comment about this. You really need to put double quotes around the source path since it could contain spaces and I am pretty sure it will fail when that is the case. Local $sCMD = @comspec & ' /c copy /y "' & @ScriptDir & '\test.bat" d:\' Jos 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...
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