Change backslash to forward slash in windows batch file

后端 未结 5 2173
醉话见心
醉话见心 2020-12-24 06:26

I\'m trying to convert all backslashes () to forward slashes (/) in a variable which contains a file name and location. I\'ve read about this and seen:

%vari         


        
5条回答
  •  不知归路
    2020-12-24 06:52

    This will work for change the backslashe to forward slashes in windows:

     typedef std::basic_string tstring;
     tstring pathbasic = tstring(programdata) + _T("\\myfile.txt");
     std::replace(pathbasic.begin(), pathbasic.end(), _T('\\'), _T('/'));
    

提交回复
热议问题