# MikTeX + TeXstudio Portable

I have a new problem. I would like to use MikTeX and TeXstudio as portable version. But I have a problem and you can help me with Stutkur

``````-Latex
--MiKTeX
---texmfs
---TexStudio
---miktex-portable.cmd
``````

I have now tried 3 workflows

1. miktex-portable.cmd -> open MiKTeX Terminal -> Comand "TexStudio\Texstudio.exe" Works great
2. added the line "TexStudio\Texstudio.exe" to miktex-portable.cmd Texstudio cannot compile
3. miktex-portable.cmd -> open cmd -> Comand "TexStudio\Texstudio.exe" Texstudio cannot compile

I don't see any difference in the TeXstudio settings and the parameters of the MikTeX-Terminal I don't find either. The aim is to start both programs via a .CMD so that they work. Can someone please give me a solution?

It is important that the path is set for Texstudio with "set PATH".

The CMD is as follows setlocal

``````start "" "%~d0%~p0MikTex\texmfs\install\miktex\bin\miktex-console.exe" --hide --mkmaps

set PATH=%~d0%~p0MikTex\texmfs\install\miktex/bin;%PATH%

start "" "%~d0%~p0miktex\TexStudio\texstudio.exe"

endlocal
``````

The structure is as follows

``````Latex
-00Template
-MikTex
--TexStudio
--texmfs
-00Start.cmd
``````

It is safer and more conventional to run from anywhere on the same drive

``````set PATH=%~d0\Latex\MikTex\texmfs\install\miktex\bin;%PATH%
%~d0\Latex\MikTex\texmfs\install\miktex\bin\miktex-console.exe" --hide --mkmaps
rem pause
%~d0\Latex\MikTex\TexStudio\texstudio.exe "%1"
``````

Differences are the %1 allows you to drag and drop a tex file onto the cmd where the path is set prior to running the console,

you may also want to add the pause between console and calling TeXstudio so you can do updates without TeXstudio locking out MiKTeX from updating / downloading critical files