# Windows file path string (slash direction, best way to copy/paste)

**URL:** https://discourse.julialang.org/t/windows-file-path-string-slash-direction-best-way-to-copy-paste/29204
**Category:** General Usage
**Created:** [September 26, 2019, 4:54pm UTC](https://discourse.julialang.org/t/windows-file-path-string-slash-direction-best-way-to-copy-paste/29204 "2019-09-26T16:54:13Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![mthelm85](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mthelm85/32/224164_2.png) [@mthelm85](https://discourse.julialang.org/u/mthelm85)
#### Post date: [September 26, 2019, 4:54pm UTC](https://discourse.julialang.org/t/windows-file-path-string-slash-direction-best-way-to-copy-paste/29204/1 "2019-09-26T16:54:13Z")

</div>

One of the most annoying things that I do on a daily basis (on my Windows 10 machine) is finding a path to a file that has some data that I want to bring into my program, right-clicking it, clicking ‘Properties’ and then highlighting/copying the file path that is visible in the window. I then paste this into my IDE wherever I need…

The reason that this is annoying is that the file path has the slashes going the wrong way:

`C:\Users\mthel\Desktop\Julia\src_data`

instead of

`C:/Users/mthel/Desktop/Julia/src_data`

As I understand it, Windows is the only OS that does it this way. I manually change the `\` to `/` every time so I’m wondering how other Windows users deal with this? Is there a better way to get the file path? I’ve thought about just writing a function that does the replacement for me…it’s not like it’s a huge time suck, it’s just a pet peeve that I don’t want to deal with anymore 😬

---

<div class="post-metadata">

### Author: ![cchderrick](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@cchderrick](https://discourse.julialang.org/u/cchderrick)
#### Post date: [September 26, 2019, 5:11pm UTC](https://discourse.julialang.org/t/windows-file-path-string-slash-direction-best-way-to-copy-paste/29204/2 "2019-09-26T17:11:18Z")

</div>

I copy/paste the path, and wrap it in raw.

```julia
raw"C:\Users\mthel\Desktop\Julia\src_data"

```

---

<div class="post-metadata">

### Author: ![js135005](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/js135005/32/8219_2.png) [@js135005](https://discourse.julialang.org/u/js135005)
#### Post date: [September 26, 2019, 5:12pm UTC](https://discourse.julialang.org/t/windows-file-path-string-slash-direction-best-way-to-copy-paste/29204/3 "2019-09-26T17:12:51Z")

</div>

I just copy the file path into a raw string. It handles the backslash being treated as escape problem.

raw"\part1\part2\etc"

Same solution as that from @cchderrick

---

<div class="post-metadata">

### Author: ![mthelm85](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mthelm85/32/224164_2.png) [@mthelm85](https://discourse.julialang.org/u/mthelm85)
#### Post date: [September 26, 2019, 5:52pm UTC](https://discourse.julialang.org/t/windows-file-path-string-slash-direction-best-way-to-copy-paste/29204/4 "2019-09-26T17:52:47Z")

</div>

Why did I not ask this question a long time ago? 😌

Thanks for your responses, I didn’t even know about `raw`.

---

<div class="post-metadata">

### Author: ![purplishrock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/purplishrock/32/13451_2.png) [@purplishrock](https://discourse.julialang.org/u/purplishrock)
#### Post date: [September 26, 2019, 9:28pm UTC](https://discourse.julialang.org/t/windows-file-path-string-slash-direction-best-way-to-copy-paste/29204/5 "2019-09-26T21:28:14Z")

</div>

So I think that julia is very well documented but sometimes it’s still difficult to find things. I didn’t know about this either so I decided to see what would happen if i just searched for “raw string”.

[https://docs.julialang.org/en/v1/manual/strings/#man-raw-string-literals-1](https://docs.julialang.org/en/v1/manual/strings/#man-raw-string-literals-1)

lol. it came right up. I too have been going through the same issues and I’m very glad you asked the question !

---

<div class="post-metadata">

### Author: ![rapasite](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rapasite/32/3719_2.png) [@rapasite](https://discourse.julialang.org/u/rapasite)
#### Post date: [November 25, 2020, 1:49pm UTC](https://discourse.julialang.org/t/windows-file-path-string-slash-direction-best-way-to-copy-paste/29204/6 "2020-11-25T13:49:21Z")

</div>

For windows users, if you use (Shift + right-click) on any files in the file explorer or the desktop.  
You will get a new entry in the right-click menu witch is call `copy as path` click on it to get the full path in the press-paper.

 ![copyaspath](https://global.discourse-cdn.com/julialang/original/3X/6/9/69ce58f085c36bf9046fb873a8d4032fee34114c.jpeg)
