> For the complete documentation index, see [llms.txt](https://docs.patchmypc.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.patchmypc.com/patch-my-pc-cloud/deployments/technical-references/reference-external-scripts.md).

# Reference External Scripts in a Patch My PC Cloud Deployment

*Applies to: Patch My PC Cloud*

If you upload [Extra Files](/patch-my-pc-cloud/deployments/deploy-app/configurations-tab/additional-tools/extra-files.md) as part of your Patch My PC (PMPC) Cloud Deployment, you can reference those files in any of the [Scripts](/patch-my-pc-cloud/deployments/deploy-app/configurations-tab/additional-tools/scripts.md) in the same deployment by building a path relative to the script's current location.&#x20;

This ensures your script can reliably locate the files you uploaded, whether they are in the root or a subfolder.

Below are examples for referencing a file named `file_to_be_copied.txt`, either from the script root or a subfolder called `MyFolder`.

## PowerShell (.ps1)

To reference additional files you’ve uploaded, use `$PSScriptRoot\file_to_be_copied.txt` or `$PSScriptRoot\MyFolder\file_to_be_copied.txt` if the file is in a subfolder.

For example:

```
# File in script root
Copy-Item -Path "$PSScriptRoot\file_to_be_copied.txt" -Destination "C:\TargetFolder"

# File in subfolder
Copy-Item -Path "$PSScriptRoot\MyFolder\file_to_be_copied.txt" -Destination "C:\TargetFolder"
 
```

## Batch / CMD (.bat / .cmd)

To reference additional files you’ve uploaded, use `%~dp0file_to_be_copied.txt` or `%~dp0MyFolder\file_to_be_copied.txt` if the file is in a subfolder.

For example:

```
:: File in script root
copy "%~dp0file_to_be_copied.txt" "C:\TargetFolder"

:: File in subfolder
copy "%~dp0MyFolder\file_to_be_copied.txt" "C:\TargetFolder" 
```

## VBScript (.vbs)

To reference additional files you’ve uploaded, use `scriptDir & "\file_to_be_copied.txt"` or `scriptDir & "\MyFolder\file_to_be_copied.txt"` if the file is in a subfolder.

For example:

```
Set fso = CreateObject("Scripting.FileSystemObject")
scriptDir = fso.GetParentFolderName(WScript.ScriptFullName)

' File in script root
fso.CopyFile scriptDir & "\file_to_be_copied.txt", "C:\TargetFolder\"

' File in subfolder
fso.CopyFile scriptDir & "\MyFolder\file_to_be_copied.txt", "C:\TargetFolder\" 
```

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.patchmypc.com/patch-my-pc-cloud/deployments/technical-references/reference-external-scripts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
