pass parameters to batch file in msdeploy runcommand

前端 未结 1 1338
别跟我提以往
别跟我提以往 2020-12-20 23:11

I am not able to get this to work

call \"%MSDeployPath%msdeploy\" -verb:sync -source:runCommand=\'backup.bat param1\' -dest:auto,computername=10.xx.xx.xx,use         


        
相关标签:
1条回答
  • 2020-12-20 23:22

    Edit You are right, the documentation states that cmd/bat files will be streamed to the destination.

    It seems to me that it's simply a limitation of the feature that it can't accept arguments. It shouldn't be too difficult to create a modified version of the batch file at deploy-time with the settings hardcoded.

    Something like:

    REM Start of prepended script
    SET SCRIPT_USERNAME=ThatGuy
    REM End of prepended script
    
    IF ("%SCRIPT_USERNAME%" == "") SET SCRIPT_USERNAME=%1
    

    Update Having browsed the reflected source (ahem) of msdeploy, I can confirm that it's simply the way it's current designed. It determines whether to upload the file based on whether the entire path represents a file. Since adding arguments will prevent it resolving the path to a file, it doesn't upload anything.

    0 讨论(0)
提交回复
热议问题