79751665

Date: 2025-08-31 09:39:17
Score: 2.5
Natty:
Report link

This question has been dead for some time now, but because there has not been any suggestion like this, I would like to post it.

My solution (not involving %CMDCMDLINE% or arguments) is to set any variable before calling another batchfile. It works even with setlocal or delayed expansion enabled.

parentBatch.bat

@echo off
setlocal
set special=1
call childBatch.bat

childBatch.bat

@echo %special%

Running parentBatch.bat would print out 1.

I suspect it's related to child processes inheriting environment variables from its parent.

Reasons:
  • RegEx Blacklisted phrase (2): any suggestion
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Honky