Jump to content
DigDeep

Runwait with @ComSpec

Recommended Posts

DigDeep

Hi,

May I please request someone to get this corrected? I think my Inverted commas are going incorrect and getting "Syntax Error".

 

$Result = "C:\Temp\Updates.txt"

RunWait(@ComSpec & " /c 'C:\Program Files\Microsoft Baseline Security Analyzer 2\MBSACLI' /n Password+OS+SQL+IIS /wa /unicode >" & $Result, "", @SW_SHOW)

or anything to make it more shorter as:

$Result = "C:\Temp\Updates.txt"
$Scan = "C:\Program Files\Microsoft Baseline Security Analyzer 2"

RunWait(@ComSpec & " /c " & $Scan & 'MBSACLI /n Password+OS+SQL+IIS /wa /unicode >' & $Result, "", @SW_SHOW)

 

Edited by DigDeep

Share this post


Link to post
Share on other sites
orbs

switch your quotes - external is single, internal is double. like this:

RunWait(@ComSpec & ' /c "C:\Program Files\Microsoft Baseline Security Analyzer 2\MBSACLI" /n Password+OS+SQL+IIS /wa /unicode >' & $FilePath1, "", @SW_SHOW)

 

Edited by orbs
  • Like 1

Share this post


Link to post
Share on other sites
orbs

works for me... what error exactly are you getting?

Share this post


Link to post
Share on other sites
DigDeep

Error...

Error.jpg

Edited by DigDeep

Share this post


Link to post
Share on other sites
orbs

what have you got before and after that line? anything on the output pane?

Share this post


Link to post
Share on other sites
DigDeep

Yeah I have loads of lines. I commented all and now it shows up good.

Thank you.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.