Klaus's BAT issues #97772
https://thebrain.zendesk.com/agent/tickets/97772
Hello Klaus,
Great context, thank you. You’re exactly right about what’s happening: TheBrain’s “Link to File” stores a file path, not a command with arguments. So a link like
\...\launch.bat 17 isn’t a valid file target, and TB will normalize it back to the file (launch.bat) only. It also resolves .lnk shortcuts to their real targets, so that route can’t carry arguments either.
The reliable approach is to make your batch file self-contained (include the argument inside the batch itself), then link to that batch file from TheBrain.
Here are a few practical patterns you can use:
- Hardcode the argument (simplest):
@echo off
start "" "D:\07 wrkst\wrkst py\TreeV\prod\TreeV.exe" 17
Link the thought to this launch.bat. If you need different records, make tiny copies like launch-3.bat, launch-17.bat, each hardcoding its own number.
2. One batch per record via filename (tidy for many records):
Name the file launch-17.bat (or TreeV-17.bat) and let the script read its own number:
@echo off
rem Extract number from this batch file’s name, e.g., launch-17.bat -> 17 set "me=%~n0"
for /f "tokens=2 delims=-" %%N in ("%me%") do set "REC=%%N"
start "" "D:\07 wrkst\wrkst py\TreeV\prod\TreeV.exe" %REC%
Now you can duplicate the file (launch-3.bat, launch-42.bat, etc.) without editing the contents. Each file becomes a unique link target in TheBrain.
3. Single batch + sidecar parameter file (no duplicates):
Keep one launch.bat and store the parameter in a small .txt beside it:
@echo off
set "DIR=D:\07 wrkst\wrkst py\TreeV\prod"
set /p REC=<"%DIR%\record.param.txt"
start "" "%DIR%\TreeV.exe" %REC%
Change the number in record.param.txt to switch the target record. TheBrain links only to launch.bat.
A couple of tips:
- Keep paths with spaces quoted (
"D:\07 wrkst\wrkst py\TreeV\prod\TreeV.exe"). - If Windows SmartScreen warns on a new
.bat, choose “More info” → “Run anyway”. - In TheBrain, use Attach → Link to File and select the
.batyou want. No.lnk, TB resolves shortcuts to targets (by design).
Best regards,
John 🙂