# Setting an environment variable back to its default value

**URL:** <https://community.postman.com/t/setting-an-environment-variable-back-to-its-default-value/52637>\
**Category:** Help Hub\
**Tags:** variables\
**Created:** [September 30, 2023, 4:54pm UTC](https://community.postman.com/t/setting-an-environment-variable-back-to-its-default-value/52637 "2023-09-30T16:54:36Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [September 30, 2023, 10:47pm UTC](https://community.postman.com/t/setting-an-environment-variable-back-to-its-default-value/52637/2 "2023-09-30T22:47:55Z")

</div>

Hey @ButtockFlesh 👋

I was going to suggest something like this method but I think you’re kinda doing this already:

> [@How to reset variables to initial value from script](https://community.postman.com/t/how-to-reset-variables-to-initial-value-from-script/20629):
>
> Add this to first request’s pre-request script: pm.environment.set("resetValue",pm.collectionVariables.toJSON().values) This wiil store all initial value to resetValue variable And in the last request’s test script use pm.environment.get("resetValue").forEach((a)=\>pm.collectionVariables.set(a.key,a.value)) Now we are resetting all collectionVariables to the initially saved value

---

_[View the full topic](https://community.postman.com/t/setting-an-environment-variable-back-to-its-default-value/52637)._
