# ROOT C++ in Windows

**URL:** <https://root-forum.cern.ch/t/root-c-in-windows/59332>\
**Category:** Newbie\
**Created:** [May 14, 2024, 10:39am UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332 "2024-05-14T10:39:07Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![A\_P\_abhisek](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/a_p_abhisek/32/34049_2.png) [@A\_P\_abhisek](https://root-forum.cern.ch/u/A_P_abhisek)\
**Post date:** [May 14, 2024, 11:45am UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332/21 "2024-05-14T11:45:10Z")

</div>

Sorry for making this hard and taking your time,

here what I am getting:  
C:\Users\abhis\>\root\bin\thisroot.bat  
The system cannot find the path specified.

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [May 14, 2024, 11:48am UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332/22 "2024-05-14T11:48:39Z")

</div>

You have an extra backslash in your command. It should be `root\bin\thisroot.bat` instead of `\root\bin\thisroot.bat`.

```cmd
C:\Users\abhis>root\bin\thisroot.bat

```

---

<div class="post-metadata">

**Author:** ![A\_P\_abhisek](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/a_p_abhisek/32/34049_2.png) [@A\_P\_abhisek](https://root-forum.cern.ch/u/A_P_abhisek)\
**Post date:** [May 14, 2024, 11:49am UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332/23 "2024-05-14T11:49:33Z")

</div>

ok it ran succesfully

---

<div class="post-metadata">

**Author:** ![A\_P\_abhisek](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/a_p_abhisek/32/34049_2.png) [@A\_P\_abhisek](https://root-forum.cern.ch/u/A_P_abhisek)\
**Post date:** [May 14, 2024, 11:50am UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332/24 "2024-05-14T11:50:59Z")

</div>

now while running root, it says “‘root’ is not recognized as an internal or external command,  
operable program or batch file.”

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [May 14, 2024, 11:52am UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332/25 "2024-05-14T11:52:57Z")

</div>

Did you type `root` after `root\bin\thisroot.bat` in the same `Developer command prompt for vs 2022` session? Probably not…

---

<div class="post-metadata">

**Author:** ![A\_P\_abhisek](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/a_p_abhisek/32/34049_2.png) [@A\_P\_abhisek](https://root-forum.cern.ch/u/A_P_abhisek)\
**Post date:** [May 14, 2024, 11:53am UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332/26 "2024-05-14T11:53:13Z")

</div>

yes, I did that

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [May 14, 2024, 11:54am UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332/27 "2024-05-14T11:54:25Z")

</div>

Can you copy and paste the whole session, like I did before, so I can see what you’re doing?

---

<div class="post-metadata">

**Author:** ![A\_P\_abhisek](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/a_p_abhisek/32/34049_2.png) [@A\_P\_abhisek](https://root-forum.cern.ch/u/A_P_abhisek)\
**Post date:** [May 14, 2024, 11:54am UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332/28 "2024-05-14T11:54:45Z")

</div>

C:\Users\abhis\>root\bin\thisroot.bat

C:\Users\abhis\>root  
‘root’ is not recognized as an internal or external command,  
operable program or batch file.

C:\Users\abhis\>

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [May 14, 2024, 11:56am UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332/29 "2024-05-14T11:56:33Z")

</div>

OK, can you copy and paste the output of `dir root\bin\*.exe`

---

<div class="post-metadata">

**Author:** ![A\_P\_abhisek](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/a_p_abhisek/32/34049_2.png) [@A\_P\_abhisek](https://root-forum.cern.ch/u/A_P_abhisek)\
**Post date:** [May 14, 2024, 11:57am UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332/30 "2024-05-14T11:57:05Z")

</div>

C:\Users\abhis\>root\bin\*.exe  
The system cannot find the path specified.

---

<div class="post-metadata">

**Author:** ![A\_P\_abhisek](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/a_p_abhisek/32/34049_2.png) [@A\_P\_abhisek](https://root-forum.cern.ch/u/A_P_abhisek)\
**Post date:** [May 14, 2024, 11:57am UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332/31 "2024-05-14T11:57:53Z")

</div>

C:\Users\abhis\>dir root\bin\*.exe  
Volume in drive C has no label.  
Volume Serial Number is 765F-C99C

Directory of C:\Users\abhis\root\bin

04/03/2024 12:36 PM 41,472 bindexplib.exe  
04/03/2024 12:24 PM 13,312 genreflex.exe  
04/03/2024 12:37 PM 56,320 hadd.exe  
04/03/2024 12:37 PM 19,968 proofserv.exe  
04/03/2024 12:37 PM 46,080 rmkdepend.exe  
04/03/2024 12:35 PM 17,920 root.exe  
04/03/2024 12:24 PM 13,312 rootcint.exe  
04/03/2024 12:24 PM 13,312 rootcling.exe  
04/03/2024 12:37 PM 54,272 rootnb.exe  
04/03/2024 12:37 PM 113,664 rootreadspeed.exe  
10 File(s) 389,632 bytes  
0 Dir(s) 70,306,627,584 bytes free

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [May 14, 2024, 12:00pm UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332/32 "2024-05-14T12:00:06Z")

</div>

Weird… Then can you start root like this: `root\bin\root.exe`

---

<div class="post-metadata">

**Author:** ![A\_P\_abhisek](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/a_p_abhisek/32/34049_2.png) [@A\_P\_abhisek](https://root-forum.cern.ch/u/A_P_abhisek)\
**Post date:** [May 14, 2024, 12:00pm UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332/33 "2024-05-14T12:00:42Z")

</div>

RegOpenKeyEx(HKEY\_LOCAL\_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots\KitsRoot10): returned 2: The system cannot find the file specified.  
input\_line\_1:1:10: fatal error: ‘new’ file not found  
#include   
^ ~~~~  
Assertion failed: OldBuilder-\>DeferredDeclsToEmit.empty() && “Should have emitted all decls deferred to emit.”, file C:\ROOT-CI\src\interpreter\llvm-project\clang\lib\CodeGen\ModuleBuilder.cpp, line 155

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [May 14, 2024, 12:02pm UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332/34 "2024-05-14T12:02:52Z")

</div>

Still from the `Developer command prompt for vs 2022 session`? Then I suppose you didn’t install the `Desktop development with C++` from the `Visual Studio Installer`?

---

<div class="post-metadata">

**Author:** ![A\_P\_abhisek](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/a_p_abhisek/32/34049_2.png) [@A\_P\_abhisek](https://root-forum.cern.ch/u/A_P_abhisek)\
**Post date:** [May 14, 2024, 1:03pm UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332/35 "2024-05-14T13:03:48Z")

</div>

how to do that

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [May 14, 2024, 1:05pm UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332/36 "2024-05-14T13:05:42Z")

</div>

From the Visual Studio Installer:

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/f/b/fbef1028c2641de52645a087500d0a10622be1da.png)

---

<div class="post-metadata">

**Author:** ![A\_P\_abhisek](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/a_p_abhisek/32/34049_2.png) [@A\_P\_abhisek](https://root-forum.cern.ch/u/A_P_abhisek)\
**Post date:** [May 14, 2024, 1:20pm UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332/37 "2024-05-14T13:20:22Z")

</div>

done! Now where to use this root permanently.

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [May 14, 2024, 1:29pm UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332/38 "2024-05-14T13:29:30Z")

</div>

You can add a new `ROOTSYS` environment variable pointing to the location of ROOT (in your case `C:\Users\abhis\root`) and add `%ROOTSYS%\bin` in your `PATH`. If you don’t know how to do this, look for `Environment variables` in the Windows Settings

---

<div class="post-metadata">

**Author:** ![A\_P\_abhisek](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/a_p_abhisek/32/34049_2.png) [@A\_P\_abhisek](https://root-forum.cern.ch/u/A_P_abhisek)\
**Post date:** [May 14, 2024, 1:31pm UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332/39 "2024-05-14T13:31:20Z")

</div>

yeah I know environment variable setting in windows, Now I will add the path C:\Users\abhis\root as the name root., then what to do!

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [May 14, 2024, 1:32pm UTC](https://root-forum.cern.ch/t/root-c-in-windows/59332/40 "2024-05-14T13:32:40Z")

</div>

> [@A\_P\_abhisek](#):
>
> Now I will add the path C:\Users\abhis\root as the name root.

No, please follow exactly what I said

> [@A\_P\_abhisek](#):
>
> then what to do!

Then you should be able to start ROOT from any `Developer command prompt for vs 2022 session`

[Previous page](https://root-forum.cern.ch/t/root-c-in-windows/59332.md?page=1)

[Next page](https://root-forum.cern.ch/t/root-c-in-windows/59332.md?page=3)
