BillNewB Posted June 13, 2017 Posted June 13, 2017 Hello All, I'm totally new to AutoIT, and I've tried to make this function work somehow, with AutoIT. This is what I've used in a dos batch file, but want to create an AutoIT script. Any help would be appreciated. set BACKUPFILENAME1=c:\ck\dbbackups\ServerTT.bak sqlcmd -S localhost -U sa -P ?????? -d tora -Q "BACKUP DATABASE test TO DISK = N'%BACKUPFILENAME1%' WITH INIT , NOUNLOAD , NAME = 'test_backup', NOSKIP , STATS = 10, NOFORMAT"
Floops Posted June 13, 2017 Posted June 13, 2017 This should work $BACKUPFILENAME1 = "c:\ck\dbbackups\ServerTT.bak" Run(@ComSpec & ' /c ' & "sqlcmd -S localhost -U sa -P ?????? -d tora -Q 'BACKUP DATABASE test TO DISK = N'" & $BACKUPFILENAME1 & "' WITH INIT , NOUNLOAD , NAME = 'test_backup', NOSKIP , STATS = 10, NOFORMAT'"
BillNewB Posted July 4, 2017 Author Posted July 4, 2017 Floops, Thanks for the reply. I was getting errors at first, but I added a ) at the end, and now I get no errors, but the backup doesn't work.
rootx Posted July 4, 2017 Posted July 4, 2017 #RequireAdmin $BACKUPFILENAME1 = "c:\ck\dbbackups\ServerTT.bak" Run(@ComSpec & ' /c ' & "sqlcmd -S localhost -U sa -P ?????? -d tora -Q 'BACKUP DATABASE test TO DISK = N'" & $BACKUPFILENAME1 & "' WITH INIT , NOUNLOAD , NAME = 'test_backup', NOSKIP , STATS = 10, NOFORMAT'",@ScriptDir,@SW_SHOW)
BillNewB Posted July 13, 2017 Author Posted July 13, 2017 rootx, Thanks for the reply, but I still can't get it to work. No errors, but no backup either.
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