Safest way to run BAT file from Powershell script

前端 未结 5 1787
眼角桃花
眼角桃花 2020-12-07 12:58

I can not get a powershell script to execute a bat file directly. For example, this works on the command line:

.\\\\my-app\\my-fle.bat

When

5条回答
  •  悲哀的现实
    2020-12-07 13:29

    Assuming my-app is a subdirectory under the current directory. The $LASTEXITCODE should be there from the last command:

    .\my-app\my-fle.bat
    

    If it was from a fileshare:

    \\server\my-file.bat
    

提交回复
热议问题