DigDeep Posted January 2, 2018 Posted January 2, 2018 (edited) I am always having difficulties to understand how to get the single & double quotes in place. My script calls the Runwait and completes within secs. Local $PatchPath = 'C:\temp\DownloadedPatch' Local $PatchDwn = '\Patch KB number directory' ; example '\4053577' Local $GetPatch = $PatchPath & '\' & $PatchDwn RunWait(@ComSpec & ' /c start /wait DISM.exe /Online /Add-Package /PackagePath:' & $GetPatch & '\' & $PatchDwn & '.cab' & ' /quiet /norestart', "", @SW_HIDE) if I put a MsgBox prior runwait as per below it tells the path and file is correct. So I think I might be doing something wrong placing the single quotes. MsgBox(0, '', $GetPatch & '\' & $PatchDwn & '.cab') Can someone help me here? Edited January 2, 2018 by DigDeep
DigDeep Posted January 2, 2018 Author Posted January 2, 2018 I take the issue back. Few days ago I had declared the $PatchDwn & '.cab' as an exe file. Script was downloading the exe file but as .cab extension and wasn't able to read it. So wasn't able to install. I have fixed that and it is working fine now. Sorry for the confusion. But I would still like to understand the way single and double quotes are placed. If someone can help with the explanation will be of good help.
water Posted January 2, 2018 Posted January 2, 2018 I think you are overcomplicating things. "Start" isn't needed because this is what RunWait does. Do you notice that you get double backslash twice in the cmdline? Can you post what you expect the commandline to look like? This example will display the commandline as it gets executed. Local $PatchPath = 'C:\temp\DownloadedPatch' Local $PatchDwn = '\Patch KB number directory' ; example '\4053577' Local $GetPatch = $PatchPath & '\' & $PatchDwn Local $CmdLine = 'dism.exe /Online /Add-Package /PackagePath:' & $GetPatch & '\' & $PatchDwn & '.cab' & ' /quiet /norestart' MsgBox(0, "Command line", $CmdLine) ; RunWait(@ComSpec & ' /k ' & $CmdLine, "", @SW_HIDE) My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
DigDeep Posted January 2, 2018 Author Posted January 2, 2018 @water, it is fixed now as per explained above. And yes, I have removed that Start / Wait also. I had put that to get the command line opened to see if it was giving any errors. That's what helped me to fix it. Can you help me explaining how to put single and double quotes? If you want I can give some examples...
Earthshine Posted January 2, 2018 Posted January 2, 2018 I believe that’s in the FAQs and also the help file My resources are limited. You must ask the right questions
water Posted January 2, 2018 Posted January 2, 2018 "Start /Wait" isn't needed either "/c" in the RunWait statement means "close" the window after execution. Replace it with "/k" to "keep" the window open after execution so you can check error messages. Strings and how to enclose them is described in the help file. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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