Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
how to change this path C:\Windows\SHELLNEW\EXCEL12.XLSX to this path C:\\Windows\\SHELLNEW\\EXCEL12.XLSX
Posted 28-Jan-13 18:47pm
Comments
jibesh at 29-Jan-13 1:44am
   
but why you need? if you can post your problem you may get a better solution for your real problem.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

U can do like this
 
string newpath =@"C:\Windows\SHELLNEW\EXCEL12.XLSX";
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

If you plan to use the path at runtime you don't need the extra '\' in the path names.
 
If you are typing in code then just add the '\' yourself since it is an escape code for c#. or you can use the '@' character :
string path = @"C:\Windows\SHELLNEW\EXCEL12.XLSX";
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

if you want to change at run time then try this
string path="C:\Windows\SHELLNEW\EXCEL12.XLSX";
path=path.Replace("\", "\\");
  Permalink  
Comments
Marco Bertschi at 21-Feb-13 16:56pm
   
My 2. Very inefficient.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 335
1 OriginalGriff 250
2 Kornfeld Eliyahu Peter 130
3 DamithSL 120
4 Peter Leow 95
0 OriginalGriff 7,355
1 DamithSL 5,199
2 Sergey Alexandrovich Kryukov 4,942
3 Maciej Los 4,906
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 29 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100