Wingens

variable in @ComSpec

3 posts in this topic

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



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

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

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

Share this post


Link to post
Share on other sites

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


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          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