BillNewB Posted June 13, 2017 Share 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" Link to comment Share on other sites More sharing options...
Floops Posted June 13, 2017 Share 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'" Link to comment Share on other sites More sharing options...
BillNewB Posted July 4, 2017 Author Share 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. Link to comment Share on other sites More sharing options...
rootx Posted July 4, 2017 Share 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) Link to comment Share on other sites More sharing options...
BillNewB Posted July 13, 2017 Author Share Posted July 13, 2017 rootx, Thanks for the reply, but I still can't get it to work. No errors, but no backup either. 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