View Full Version : problem with backslash and "replace in file"
iryshia
03-11-2005, 07:33 AM
I need to replace in file a path, this path contain backslash \. How I do?
Thanks
kinook
03-11-2005, 07:50 AM
When using regex mode ('Treat all characters as literals' unchecked) in the Replace in File action, \ is an escape character; use \\ to match a literal backslash character. See the regular expression references listed at http://visualbuild.com/Manual/?filereplaceaction.htm for more details.
abcdetech
07-31-2009, 03:42 PM
what if I want to replace a text with a variable %WORK_ROOT%
where %WORK_ROOT% defined as c:\temp\bin?
After testing my step I'm getting :
<HintPath>c:tempbin</HintPath>
(missing backslashes)
kinook
07-31-2009, 04:43 PM
[Replace("%WORK%_ROOT%", "\", "\\")]
http://www.kinook.com/VisBuildPro/Manual/scriptexpressions.htm
http://www.w3schools.com/Vbscript/func_replace.asp
abcdetech
08-03-2009, 09:22 AM
thanks it some how works but doesn't fully do what I intended to do. I should've posted all my string.
I've solved a problem with backslashes but now I'm getting a problem with a $
I need to insert this string
%WORK_ROOT%\bin\$ConfigurationName between <HintPath> tags.
where %WORK_ROOT% is defined as c:\temp
after implementing your tip I'm getting:
<HintPath>c:\temp\bin\$ConfigurationName<\HintPath>
can't figure out how to solve a problem with the $ symbol.
I'm expecting to see:
<HintPath>c:\temp\bin\Debug<\HintPath>
<HintPath>c:\temp\bin\Release<\HintPath>
<HintPath>c:\temp\bin\Debug_MT<\HintPath>..........
thank you
kinook
08-03-2009, 09:56 AM
I guess you're doing something like
http://www.kinook.com/Forum/showthread.php?threadid=4076
but using $(ConfigurationName) rather than $(OutDir)? Those types of macros/variables are resolved by Visual Studio, not by VBP. They will not be replaced by an actual configuration name in the project file, but will instead be interpreted and converted by VS when building the project.
When using an expression like that in the replacement field of the Replace in File action, you need to escape the parentheses (see the attachment in the link above):
$\(ConfigurationName\)
vBulletin® v3.8.11, Copyright ©2000-2024, vBulletin Solutions Inc.