Au3Builder Posted February 9, 2018 Posted February 9, 2018 (edited) Any idea what's wrong with this? I want to zip a folder of mine. Run('powershell.exe Compress-Archive -Path "C:\Users\GOD\Desktop\New Folder" -DestinationPath "test.zip"') Edited February 9, 2018 by Au3Builder
Zedna Posted February 9, 2018 Posted February 9, 2018 Look here, probably its related https://www.autoitscript.com/trac/autoit/ticket/3590 Resources UDF ResourcesEx UDF AutoIt Forum Search
Au3Builder Posted February 9, 2018 Author Posted February 9, 2018 (edited) I highly doubt it. Windows PowerShell itself compresses the folder without errors. Only Autoit doesn't and i'm using the previous version. Edited February 9, 2018 by Au3Builder
jdelaney Posted February 9, 2018 Posted February 9, 2018 If you run the exact command in the run window, does it execute fully? windowskey +r Au3Builder 1 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Au3Builder Posted February 9, 2018 Author Posted February 9, 2018 (edited) 9 minutes ago, jdelaney said: If you run the exact command in the run window, does it execute fully? windowskey +r Nope .In short, I have accomplished the task only in two scenarios. a) I copy & paste the exact command to Windows Powershell console. b.) I create a powershell script and I run it with powershell. Edited February 9, 2018 by Au3Builder
jdelaney Posted February 9, 2018 Posted February 9, 2018 (edited) Ok, good. I'm sure someone could help with this issue, but it's not an autoit issue. Maybe use the -command parameter? else you have to keep googleing, or go to a powershell forum Edited February 9, 2018 by jdelaney Au3Builder 1 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Earthshine Posted February 9, 2018 Posted February 9, 2018 (edited) Use 7zip for applications. They have an exe you can use from installers and what not. I pack it with my installers to un zip my shit. But it can be used to zip stuff. Are use it to create my build archives Edited February 9, 2018 by Earthshine Au3Builder 1 My resources are limited. You must ask the right questions
Moderators JLogan3o13 Posted February 9, 2018 Moderators Posted February 9, 2018 (edited) If it is not working from the run command, as was stated, sounds like a PowerShell issue. Perhaps you should ask on a PowerShell forum. Edited February 9, 2018 by JLogan3o13 Au3Builder 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Au3Builder Posted February 9, 2018 Author Posted February 9, 2018 (edited) 1 hour ago, JLogan3o13 said: If it is not working from the run command, as was stated, sounds like a PowerShell issue. Perhaps you should ask on a PowerShell forum. I bet lots of people use AutoIt in conjuction with PowerShell. sooner or later somebody posts me a solution here.nonetheless many thanks to you, Earthshine and Jdelaney. Edited February 9, 2018 by Au3Builder
Subz Posted February 10, 2018 Posted February 10, 2018 It worked for me under these conditions: Changed the double quotes in your code above to single quotes Changed the single quotes in your code above to double quotes Use full path for -DestinationPath Or Use WorkingDir Run("powershell.exe Compress-Archive -Path 'C:\Users\GOD\Desktop\New Folder' -DestinationPath 'C:\Users\GOD\Desktop\test.zip'") Or Run("powershell.exe Compress-Archive -Path 'C:\Users\GOD\Desktop\New Folder' -DestinationPath 'test.zip'", 'C:\Users\GOD\Desktop')
iamtheky Posted February 10, 2018 Posted February 10, 2018 (edited) and anytime you are dealing with quoted things within a quoted string, you can always set them to a var to ensure that quotes are not the issue. e.g. $spath = "'C:\Users\GOD\Desktop\New Folder'" $dpath = "'C:\Users\GOD\Desktop\test.zip'" Run("powershell Compress-Archive -Path " & $spath & " -DestinationPath " & $dpath) Edited February 10, 2018 by iamtheky Au3Builder and Earthshine 2 ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
Au3Builder Posted February 10, 2018 Author Posted February 10, 2018 (edited) 7 hours ago, Subz said: Run("powershell.exe Compress-Archive -Path 'C:\Users\GOD\Desktop\New Folder' -DestinationPath 'C:\Users\GOD\Desktop\test.zip'") Thank you! I can't explain why but putting double & single quotes in the right order as mentioned above solved the issue . it would be great If somebody could elaborate on this so I knew what the point is. Edited February 10, 2018 by Au3Builder
Subz Posted February 10, 2018 Posted February 10, 2018 If you run the code in Cmd, you'll see the error, it strips the quotes unless you use single quotes or escape the double quotes, its a fairly common issue when running PowerShell.exe from command line. Compress-Archive : A positional parameter cannot be found that accepts argument 'Folder'. At line:1 char:1 + Compress-Archive -Path C:\Users\GOD\Desktop\New Folder -DestinationPath test.zip + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Compress-Archive], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Compress-Archive Au3Builder 1
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