Sign in to follow this  
Followers 0
clarkster26

Running command with parameters

8 posts in this topic

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.

Share this post


Link to post
Share on other sites



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)"')

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

That worked. So using a ' instead of " . Is that simply because I am using " in the command? I couldn't find what the /k switch does because I also seen some people using /c instead. Thanks for your help.

Share this post


Link to post
Share on other sites

/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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

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 ;)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

That worked thanks for all the help.

Share this post


Link to post
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
Sign in to follow this  
Followers 0