Jump to content

help with comspec syntax please


Recommended Posts

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!

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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 ^_^

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...