Jump to content

Running command with parameters


Recommended Posts

I have read the help file and searched the forums for similar issues but none of them have helped me. The problem I have is when I run this command in blue in a command line it works perfect.

msbp.exe backup "db(database=master;backuptype=full;)" "zip64(level=7)" "local(path=\\172.16.1.142\backup2\computerone\master\master.$sJulDate_1.bak.zip)"

This is the the only way I could figure out how to get all the "s and spaces in the correct places. I have tried both just the executable msbp.exe and the full path c:\msbp\msbp.exe and it didn't seem to make a difference.

Run(@ComSpec & ' /k ,"msbp.exe" ""backup" """db(database=master;backuptype=full;)""" """zip64(level=7)""" """local(path=\\172.16.1.142\backup2\computerone\master\master.$sJulDate_1.bak.zip)""""')

After compiling it and running it I get the following:

Unknown command: backup "db(database=master;backuptype=full;)" "zip64(level=7)" "local(path=\\172.16.1.142\backup2\computerone\master\master.$sJulDate_1.bak.zip)"

Below are the commands for msbp.exe:

msbp.exe help

msbp.exe backup

msbp.exe restore

msbp.exe listplugins

msbp.exe helpplugin

msbp.exe version

For more information, type msbp.exe help <command>

C:\>

I don't understand because it seems to output exactly what I need it to and if I copy everything in red and paste it in a command line after the executable name it works perfectly. Sorry I am new to Autoit so forgive me if I left something out. Am I missing something or can someone point me in the right direction? Thanks in advance for your help.

Link to comment
Share on other sites

  • Developers

try:

Run(@ComSpec & ' /k msbp.exe backup "db(database=master;backuptype=full;)" "zip64(level=7)" "local(path=\\172.16.1.142\backup2\computerone\master\master.$sJulDate_1.bak.zip)"')

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

  • Developers

/K & /C are CMD.exe parameters so are easy to figure out ;)

C:\Users\Jos>cmd /?
Starts a new instance of the Windows command interpreter

CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
    [[/S] [/C | /K] string]

/C    Carries out the command specified by string and then terminates
/K    Carries out the command specified by string but remains

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

Now when I try to use variables it comes back trying to use the variable name instead of the what the variable is. For example.

Run(@ComSpec & ' /k msbp.exe backup "db(database=$CmdLine[1];backuptype=full;)" "zip64(level=7)" "local(path=172.16.1.142backup2computerone$CmdLine[1]$CmdLine[1].$sJulDate_1.bak.zip)"')

Is there some other switch I have to use to be able to pass variables in the command?

Link to comment
Share on other sites

  • Developers

Are you not using SciTE as editor?

Anyway, this is the waty to concatenate literal strings with variables:

Run(@ComSpec & ' /k msbp.exe backup "db(database=' & $CmdLine[1] & ';backuptype=full;)" "zip64(level=7)" "local(path=\\172.16.1.142\backup2\computerone\' & $CmdLine[1] & '\' & $CmdLine[1] & '.$sJulDate_1.bak.zip)"')

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...