<titledata-rh="true">FAQ | Task</title><metadata-rh="true"name="viewport"content="width=device-width,initial-scale=1"><metadata-rh="true"name="twitter:card"content="summary_large_image"><metadata-rh="true"property="og:url"content="https://taskfile.dev/faq/"><metadata-rh="true"name="docusaurus_locale"content="en"><metadata-rh="true"name="docsearch:language"content="en"><metadata-rh="true"name="og:image"content="https://taskfile.dev/img/og-image.png"><metadata-rh="true"name="docusaurus_version"content="current"><metadata-rh="true"name="docusaurus_tag"content="docs-default-current"><metadata-rh="true"name="docsearch:version"content="current"><metadata-rh="true"name="docsearch:docusaurus_tag"content="docs-default-current"><metadata-rh="true"property="og:title"content="FAQ | Task"><metadata-rh="true"name="description"content="This page contains a list of frequently asked questions about Task."><metadata-rh="true"property="og:description"content="This page contains a list of frequently asked questions about Task."><linkdata-rh="true"rel="icon"href="/img/favicon.ico"><linkdata-rh="true"rel="canonical"href="https://taskfile.dev/faq/"><linkdata-rh="true"rel="alternate"href="https://taskfile.dev/faq/"hreflang="en-US"><linkdata-rh="true"rel="alternate"href="https://taskfile.dev/zh-Hans/faq/"hreflang="zh-Hans"><linkdata-rh="true"rel="alternate"href="https://taskfile.dev/faq/"hreflang="x-default"><linkdata-rh="true"rel="preconnect"href="https://7IZIJ13AI7-dsn.algolia.net"crossorigin="anonymous"><linkrel="preconnect"href="https://www.google-analytics.com">
current shell, so it can't change the environment of the shell that started it.
This limitation is shared by other task runners and build tools too.</p><p>A common way to work around this is to create a task that will generate output
that can be parsed by your shell. For example, to set an environment variable on
your shell you can write a task like this:</p><divclass="language-yaml codeBlockContainer_Ckt0 theme-code-block"style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><divclass="codeBlockContent_biex"><pretabindex="0"class="prism-code language-yaml codeBlock_bY9V thin-scrollbar"><codeclass="codeBlockLines_e6Vv"><spanclass="token-line"style="color:#393A34"><spanclass="token key atrule"style="color:#22863A">my-shell-env</span><spanclass="token punctuation"style="color:#393A34">:</span><spanclass="token plain"></span><br></span><spanclass="token-line"style="color:#393A34"><spanclass="token plain"></span><spanclass="token key atrule"style="color:#22863A">cmds</span><spanclass="token punctuation"style="color:#393A34">:</span><spanclass="token plain"></span><br></span><spanclass="token-line"style="color:#393A34"><spanclass="token plain"></span><spanclass="token punctuation"style="color:#393A34">-</span><spanclass="token plain"> echo "export FOO=foo"</span><br></span><spanclass="token-line"style="color:#393A34"><spanclass="token plain"></span><spanclass="token punctuation"style="color:#393A34">-</span><spanclass="token plain"> echo "export BAR=bar"</span><br></span></code></pre><divclass="buttonGroup__atx"><buttontype="button"aria-label="Copy code to clipboard"title="Copy"class="clean-btn"><spanclass="copyButtonIcons_eSgA"aria-hidden="true"><svgclass="copyButtonIcon_y97N"viewBox="0 0 24 24"><pathd="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svgclass="copyButtonSuccessIcon_LjdS"viewBox="0 0 24 24"><pathd="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Now run <code>eval $(task my-shell-env)</code> and the variables <code>$FOO</code> and <code>$BAR</code> will be
available in your shell.</p><h2class="anchor anchorWithStickyNavbar_LWe7"id="x-builtin-command-doesnt-work-on-windows">'x' builtin command doesn't work on Windows<ahref="#x-builtin-command-doesnt-work-on-windows"class="hash-link"aria-label="Direct link to heading"title="Direct link to heading"></a></h2><p>The default shell on Windows (<code>cmd</code> and <code>powershell</code>) do not have commands like
<code>rm</code> and <code>cp</code> available as builtins. This means that these commands won't work.
If you want to make your Taskfile fully cross-platform, you'll need to work
around this limitation using one of the following methods:</p><ul><li>Use the <code>{{OS}}</code> function to run an OS-specific script.</li><li>Use something like <code>{{if eq OS "windows"}}powershell {{end}}<my_cmd></code> to
detect windows and run the command in Powershell directly.</li><li>Use a shell on Windows that supports these commands as builtins, such as <ahref="https://gitforwindows.org/"target="_blank"rel="noopener noreferrer">Git
Bash</a> or <ahref="https://learn.microsoft.com/en-us/windows/wsl/install"target="_blank"rel="noopener noreferrer">WSL</a>.</li></ul><p>We want to make improvements to this part of Task and the issues below track