Wingens Posted August 10, 2016 Share Posted August 10, 2016 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? Link to comment Share on other sites More sharing options...
TheDcoder Posted August 10, 2016 Share Posted August 10, 2016 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) EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
Developers Jos Posted August 10, 2016 Developers Share Posted August 10, 2016 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 etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now