Jump to content
Wingens

variable in @ComSpec

Recommended Posts

Wingens

Hi I am trying to run a command from @ComSpec with a Variable in the syntax.

 

At the moment is this mycode:

RunWait(@ComSpec & " /c " & 'c:\bfretail\mysql\bin\mysql.exe -u"root" -p"*******" -h"localhost" -e"select count(*) from sessie where ss_datum >= ''2015-01-01'';" -Dbnfdta > C:\Temp\sessies.txt', "", @SW_HIDE)

Where I want to edit the command to automaticly find the year minus 1 like this:

Global $YEAR = @YEAR - 1

RunWait(@ComSpec & " /c " & 'c:\bfretail\mysql\bin\mysql.exe -u"root" -p"*******" -h"localhost" -e"select count(*) from betaling where bl_datum >=' & $YEAR & '-01-01'';" -Dbnfdta > C:\Temp\betaalregels.txt', "", @SW_HIDE)

But how do i create the right command syntax to use this?

Share this post


Link to post
Share on other sites
TheDcoder

I believe that this is easier:

RunWait(@ComSpec & " /c " & 'c:\bfretail\mysql\bin\mysql.exe -u"root" -p"*******" -h"localhost" -e"select count(*) from betaling where bl_datum >=' & (@YEAR - 1) & '-01-01'';" -Dbnfdta > C:\Temp\betaalregels.txt', "", @SW_HIDE)

 


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) mean to do that to anybody!!!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites
Jos

Assume you are having issues with what you posted? :)

When you need single quotes around the date, you are missing  the start single quote. Guess this should work:

RunWait(@ComSpec & " /c " & 'c:\bfretail\mysql\bin\mysql.exe -u"root" -p"*******" -h"localhost" -e"select count(*) from betaling where bl_datum >=''' & $YEAR & '-01-01'';" -Dbnfdta > C:\Temp\betaalregels.txt', "", @SW_HIDE)

Jos


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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

×