Batch string replace

后端 未结 3 1419
伪装坚强ぢ
伪装坚强ぢ 2020-12-21 19:06

I have a variable like this

\"Folder With Spaces/filename.ext\"

When I pass it to my program via PHP\'s system command, arguments are separ

相关标签:
3条回答
  • 2020-12-21 19:13

    Just enclose the parameter that has spaces with quotes.

    system("batch.bat \"Folder With Spaces/filename.ext\"");
    
    0 讨论(0)
  • 2020-12-21 19:29

    try this in your batch file:

    set str=hello_world_try_this
    set str=%str:_= %
    echo.%str%
    
    0 讨论(0)
  • 2020-12-21 19:30

    You may want to try escapeshellcmd(), like this:

    $path = escapeshellcmd("Folder With Spaces/filename.ext");  
    system("batch.bat \"$path\"");
    
    0 讨论(0)
提交回复
热议问题