Passing windows slash (/) based parameters to a program from bash script

老子叫甜甜 提交于 2019-11-30 08:09:18

Since my comment actually provided the answer, I'll post it.

How about escaping a forward slash to another forward slash like //. It works for me when I execute this command where I escaped the /r parameter: start C:/folder/beep 2000 250 100 //r 3

Source: http://oldwiki.mingw.org/index.php/switches%20with%20forward%20slashes

Minimalist GNU for Windows

Passing switches with forward slashes under MSYS

In MSYS a command line argument of "/c" is interpreted as the C: drive, so to pass any argument beginning with a forward slash you need to use two forward slashes. For example, to use this command in MSYS:

cmd /c echo foo

Use:

cmd //c echo foo

If you need to have the windows-style of a path in a shell script, you can do

x=$(cd /unix/path && cmd //c cd)

The x var now contains the windows equivalent path to /unix/path

Tracker1

After hours of looking for various searches like "disable bash file expansion" and the like, I found it by searching specifically for "bash" "windows" taskkill the executable I was trying to run, I came across this answer, which finally worked for me.

cmd " /c taskkill /F /IM ssh-agent.exe"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!