- 1 year ago
Export node variable in windows like on mac
It seems like you want to export a variable in Windows using a similar command as you would on macOS. On macOS and Linux, you can use the export
command to set environment variables. In Windows, you need to use a slightly different syntax to achieve the same thing.
On macOS/Linux (using export
):
bashexport MY_VARIABLE=value
On Windows (using set
):
batchset MY_VARIABLE=value
Keep in mind that environment variables set in this way will only persist for the current command prompt session. If you want to make the variable available in subsequent sessions or batch scripts, you might need to consider using the setx
command, which sets system-wide environment variables.
On Windows (using setx
):
batchsetx MY_VARIABLE value
After using setx
, the variable will be available for any new command prompt sessions and in batch scripts. However, changes made with setx
won't be immediately visible in the current command prompt session. You might need to open a new command prompt window to see the changes.
Remember that the specific syntax and behavior of these commands might vary slightly based on your Windows version. Always refer to the official documentation or use the command's help (/help
or --help
) for detailed information.