Reputation: 2469
Question
I'm trying to execute a command with the format {C:\...\executable} build {C:\...\executable} link
. Here is the specific example I'm trying to execute. All it does is install a golang
module which lets me debug in vs code.
C:\Program Files\Go\bin\go.exe build -o C:\Users\linds\go\bin\dlv-dap.exe github.com/go-delve/delve/cmd/dlv
The issue i'm having is that I don't know how to actually execute it. I've tried running it in powershell
and bash
but both come back and say that I cant run program with the form C:\...
.
How do I execute code with the following or similar formats?
~~
Sorry that my descriptions of the issue aren't the best because frankly I hardly know what I'm dealing with right here. I can clarify more if needed.
Upvotes: 0
Views: 66
Reputation: 437090
Since you're trying to invoke an executable whose path contains spaces, you must quote the path in order for a shell to recognize it as a single argument.
& 'C:\Program Files\Go\bin\go.exe' build -o C:\Users\linds\go\bin\dlv-dap.exe github.com/go-delve/delve/cmd/dlv
Note: &
, the call operator, isn't always needed, but is needed whenever a command path is quoted and/or contains variable references - see this answer for details.
cmd.exe
:"C:\Program Files\Go\bin\go.exe" build -o C:\Users\linds\go\bin\dlv-dap.exe github.com/go-delve/delve/cmd/dlv
Upvotes: 2