Here is the message: Syntax::sntx: Invalid syntax in or before "StringReplace[Import[C:\Users\TAT\AppData\Roaming\Mathematica\Kernel\init .m, String], p:(PrependTo[$Path,~~Shortest[Except[ | ^ " (line 1 of "C:\Users\TAT\AppData\Roaming\Mathematica\Kernel\init.m").
It shows only when I first open Mathematica. I tried reinstalling, but the message is still there.
I uninstalled Mathematica and deleted all of the Mathematica folders and then did the reinstall. The message is now gone and init.m file looks like you described yours with just a comment : (** User Mathematica initialization file **).
Thank you for your time and advice
Do you have MathModelica? The file C:\Users\TAT\AppData\Roaming\Mathematica\Kernel\init.m is the user mathematica initialization file, in my case it contains simply a comment
(** User Mathematica initialization file **)
followed by one empty line. Do you have that file C:\Users\TAT\AppData\Roaming\Mathematica\Kernel\init.m on your system? In your case Mathematica tries to import something from the user mathematica initialization file and use that to extend the $Path with a path for MathModelica.
StringReplace[Import[C:\Users\TAT\AppData\Roaming\Mathematica\Kernel\init.m, String], p:(PrependTo[$Path,~~Shortest[Except[ | ]...~~MathModelica~~Except[ | ]...]~~];) :> (* <>p<> *)]
is wrong because the target behind RuleDelayed is outcommented.
You should probably find the originator of that StringReplace statement and correct or remove it. Help can be found here init.m and here WolframSystemSetup.
Did you take a look into this file C:\Users\TAT\AppData\Roaming\Mathematica\Kernel\init.m? Because the error message is concernd about line 1 of it? Is there some unprintable character or something else unusual in it by chance? Often it helps to identical edit a file (in the end it has no visible change). Make a security copy of it before starting to edit it, please. Do you have some non-ASCII characters in path names? Some tools dislike that, despite the fact that Windows itself is Unicode, but some tools are not Unicode.
This the content of the init.m file:
StringReplace[Import[C:\Users\TAT\AppData\Roaming\Mathematica\Kernel\init.m, String], p:(PrependTo[$Path,~~Shortest[Except[ |
]...]~~];) :> (* <>p<> *)]
Do I need to change something in it?