Jump to content
Sign in to follow this  
W00tever

help with comspec syntax please

Recommended Posts

W00tever

Hi all, new user to auto it and stumped. I've tried shellexecute, runwait comspec, and run comspec and constantly given can't find the path specified when including anything after the first command.

dim $startdate

dim $enddate

dim $cmd

dim $options

dim $output

$cmd = "certutil -config servername\CA 1 -view -restrict"

$startdate = "NotAfter>=1/1/2009 08:00AM,"

$enddate = "NotAfter<=3/1/2009 08:00AM,"

$options = "commonname>=empty,request organization=myorg"

$output = "-out commonname,certificate expiration date,requester name"

Run(@ComSpec & " /k " & $cmd & $startdate & $enddate & $options & $output, "c:\windows\system32")

here is the working command

certutil -config "servername\CA 1" -view -restrict "NotAfter>=1/1/2009 08:00AM,NotAfter<=3/1/2009 08:00AM,commonname>=empty,request organization=myorg" -out "commonname,certificate expiration date,requester name"

appreciate any pointers you could give me. Thanks!

Share this post


Link to post
Share on other sites
99ojo

Hi all, new user to auto it and stumped. I've tried shellexecute, runwait comspec, and run comspec and constantly given can't find the path specified when including anything after the first command.

dim $startdate

dim $enddate

dim $cmd

dim $options

dim $output

$cmd = "certutil -config servername\CA 1 -view -restrict"

$startdate = "NotAfter>=1/1/2009 08:00AM,"

$enddate = "NotAfter<=3/1/2009 08:00AM,"

$options = "commonname>=empty,request organization=myorg"

$output = "-out commonname,certificate expiration date,requester name"

Run(@ComSpec & " /k " & $cmd & $startdate & $enddate & $options & $output, "c:\windows\system32")

here is the working command

certutil -config "servername\CA 1" -view -restrict "NotAfter>=1/1/2009 08:00AM,NotAfter<=3/1/2009 08:00AM,commonname>=empty,request organization=myorg" -out "commonname,certificate expiration date,requester name"

appreciate any pointers you could give me. Thanks!

Hi,

have a look on your working command. As result your Code should look like:

$cmd = "certutil -config """ & "servername\CA 1""" & " -view -restrict "
$startdate = """NotAfter>=1/1/2009 08:00AM,"
$enddate = "NotAfter<=3/1/2009 08:00AM,"
$options = "commonname>=empty,request organization=myorg """
$output = " -out """ & "commonname,certificate expiration date,requester name"""
MsgBox (0,"",$cmd & $startdate & $enddate & $options & $output) ; 4 controloutput of running command

;Run(@ComSpec & " /k " & $cmd & $startdate & $enddate & $options & $output, "c:\windows\system32")

you may have to alter the variables because of ". Therefore you can use the MsgBox

;-))

Stefan

Edited by 99ojo

Share this post


Link to post
Share on other sites
Juvigy

Isnt that

RunWait(@COMSPEC & " /c and not

RunWait(@COMSPEC & " /k ????

Share this post


Link to post
Share on other sites
W00tever

Hi,

have a look on your working command. As result your Code should look like:

$cmd = "certutil -config """ & "servername\CA 1""" & " -view -restrict "
$startdate = """NotAfter>=1/1/2009 08:00AM,"
$enddate = "NotAfter<=3/1/2009 08:00AM,"
$options = "commonname>=empty,request organization=myorg """
$output = " -out """ & "commonname,certificate expiration date,requester name"""
MsgBox (0,"",$cmd & $startdate & $enddate & $options & $output) ; 4 controloutput of running command

;Run(@ComSpec & " /k " & $cmd & $startdate & $enddate & $options & $output, "c:\windows\system32")

you may have to alter the variables because of ". Therefore you can use the MsgBox

;-))

Stefan

Here is what I get. When run as is.

C:\Windows\System32\scripts\autoit\new.au3(1,71) : ERROR: syntax error (illegal character)

$cmd = "certutil -config """ & "servername\CA 1 -view -restrict " & """

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Windows\System32\scripts\autoit\new.au3 - 1 error(s), 0 warning(s)

so I removed the last quote and the msgbox syntax looks perfect. Then when you run the actual it says

The system cannot find the path specified.

c:\windows\system32>

I'm very confused now ^_^

Share this post


Link to post
Share on other sites
W00tever

I got it! Thanks Stefan for pointing me in the right direction.

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
Sign in to follow this  

×