DevilChris Posted October 13, 2014 Posted October 13, 2014 Hi All, I have written a simple script to run cmd command but they contain space in file path and parameter. I would like to seek advice on how to correct phase them. Thanks If @OSArch = "X86" Then ;x86 installation RunWait(@ComSpec & " /c " & '"C:\Program Files\Symantec\Symantec Endpoint Protection\SMC.exe" -stop -p 123445', "", @SW_HIDE) ElseIf @OSArch = "X64" Then ;else x64 installation RunWait(@ComSpec & " /c " & '"C:\Program Files (x86)\Symantec\Symantec Endpoint Protection\SMC.exe" -stop -p 123445', "", @SW_HIDE) Endif
spudw2k Posted October 13, 2014 Posted October 13, 2014 Those look correct to me. Do they fail to run? Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
DevilChris Posted October 13, 2014 Author Posted October 13, 2014 (edited) Those look correct to me. Do they fail to run? I corrected this code in the afternoon but not sure if it's correct. Previously is as below which does not work If @OSArch = "X86" Then ;x86 installation RunWait(@ComSpec & " /c " & '"C:\Program Files\Symantec\Symantec Endpoint Protection\SMC.exe" -stop -p 123445"', "", @SW_HIDE) ElseIf @OSArch = "X64" Then ;else x64 installation RunWait(@ComSpec & " /c " & '"C:\Program Files (x86)\Symantec\Symantec Endpoint Protection\SMC.exe" -stop -p 123445"', "", @SW_HIDE) Endif But i just browse the forum and found out that using ShellExecute also works. Mind advising on the code below? If @OSArch = "X86" Then ;x86 installation Shellexecute('C:\Program Files\Symantec\Symantec Endpoint Protection\SMC.exe','-p "12334567" -stop',"", "", @SW_HIDE) ElseIf @OSArch = "X64" Then ;else x64 installation Shellexecute('C:\Program Files (x86)\Symantec\Symantec Endpoint Protection\SMC.exe','-p "12345678" -stop',"", "", @SW_HIDE) Endif Edited October 13, 2014 by DevilChris
jdelaney Posted October 13, 2014 Posted October 13, 2014 (edited) Use a /k switch, rather than a /c, and don't hide the console...see what's the issue with the command. Looks fine. Edited October 13, 2014 by jdelaney 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.
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