JamesDover Posted May 23, 2008 Posted May 23, 2008 (edited) I have looked every were and i know this is easy but how do i space variables so they don't crowd switches. Run(@ComSpec & " /c mysqldump.exe" & " -u root -pxxxxx " & $Backuptype & $Database & " > " & $Database & "_" & $Trim & "_" & @YEAR & @MON & @MDAY & ".sql", @ScriptDir, @SW_HIDE) The -pxxxxx "& $Backuptype & crowd like this -pxxxxx--opt Cheers Edited May 23, 2008 by JamesDover
PsaltyDS Posted May 23, 2008 Posted May 23, 2008 I have looked every were and i know this is easy but how do i space variables so they don't crowd switches. Run(@ComSpec & " /c mysqldump.exe" & " -u root -pxxxxx " & $Backuptype & $Database & " > " & $Database & "_" & $Trim & "_" & @YEAR & @MON & @MDAY & ".sql", @ScriptDir, @SW_HIDE) The -pxxxxx "& $Backuptype & crowd like this -pxxxxx--opt Cheers I don't get it. The only crowding I see is between "--opt" and the database name because that's the way you specified it with "$Backuptype & $Database" vice "$Backuptype & ' ' & $Database". So I don't see your issue, but you might consider StringFormat() to help it out: $sUser = "root" $sPass = "xxxxx" $Backuptype = "--opt" $Database = "MyDatabase" $Trim = "Trim" $sFormatString = "%s /c mysqldump.exe -u %s -p%s %s %s > %s_%s_%s%s%s.sql" $sExtCmd = StringFormat($sFormatString, @ComSpec, $sUser, $sPass, $Backuptype, $Database, $Database, $Trim, @YEAR, @MON, @MDAY) ; Run($sExtCmd, , @ScriptDir, @SW_HIDE) ConsoleWrite("Debug: " & $sExtCmd & @LF) $sExtCmd = @ComSpec & " /c mysqldump.exe" & " -u root -pxxxxx " & $Backuptype & $Database & " > " & $Database & "_" & $Trim & "_" & @YEAR & @MON & @MDAY & ".sql" ConsoleWrite("Debug: " & $sExtCmd & @LF) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
JamesDover Posted May 27, 2008 Author Posted May 27, 2008 Excellent I'll give it a go. Cheers I don't get it. The only crowding I see is between "--opt" and the database name because that's the way you specified it with "$Backuptype & $Database" vice "$Backuptype & ' ' & $Database". So I don't see your issue, but you might consider StringFormat() to help it out: $sUser = "root" $sPass = "xxxxx" $Backuptype = "--opt" $Database = "MyDatabase" $Trim = "Trim" $sFormatString = "%s /c mysqldump.exe -u %s -p%s %s %s > %s_%s_%s%s%s.sql" $sExtCmd = StringFormat($sFormatString, @ComSpec, $sUser, $sPass, $Backuptype, $Database, $Database, $Trim, @YEAR, @MON, @MDAY) ; Run($sExtCmd, , @ScriptDir, @SW_HIDE) ConsoleWrite("Debug: " & $sExtCmd & @LF) $sExtCmd = @ComSpec & " /c mysqldump.exe" & " -u root -pxxxxx " & $Backuptype & $Database & " > " & $Database & "_" & $Trim & "_" & @YEAR & @MON & @MDAY & ".sql" ConsoleWrite("Debug: " & $sExtCmd & @LF)
JamesDover Posted May 27, 2008 Author Posted May 27, 2008 It worked perfectly Output: Debug: C:\windows\system32\cmd.exe /c mysqldump.exe -u root -pxxxxx --opt database > database_opt_20080527.sql Correct one Debug: C:\windows\system32\cmd.exe /c mysqldump.exe -u root -pxxxxx --optdatabase > database_opt_20080527.sql My old one Cheers
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