How to execute a simple Windows command in Golang?

后端 未结 6 1975
执念已碎
执念已碎 2020-12-08 10:06

How to run a simple Windows command?

This command:

exec.Command(\"del\", \"c:\\\\aaa.txt\")

.. outputs th

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-08 10:41

    Found another solution too. Create a batch file that contains the following: del c:\aaa.txt

    Then call it like this:

    exec.Command("c:\\del.bat").Run()
    

提交回复
热议问题