|
Answer» I'm attempting to execute a bat file which SETS a variable and then have that variable available to a second bat file. So I set up a test.. TEST0-BAT.BAT RUNS TEST1-BAT.BAT WHICH IN TURN RUNS TEST2-BAT.BAT
My issue is I'm not getting anything in TEST1-BAT for the variable - Timestamp3 which is set in TEST2-BAT.BAT. The echo stmts. in TEST2-BAT appear to show all variables are set correctly,
I'm running WIN. 10 XP.
Anyone have any ideas / advice ?
thanks
TEST0-BAT CONTAINS: TEST1-BAT.BAT > TEST1-BAT.OUT 2> TEST1-BAT.ERR
TEST1-BAT.BAT CONTAINS: TEST2-BAT > TEST2-BAT.OUT 2> TEST2-BAT.ERR FOR /F "tokens=*" %%i IN ('TEST2-BAT.bat') DO set Timestamp3=%%i echo %Timestamp3% ren testX.txt "TESTX-%Timestamp3%.txt"
TEST2-BAT CONTAINS: echo off cls echo Date format = %date% set "dd=%date:~7,2%" set "mm=%date:~4,2%" set "yyyy=%date:~10,4%" echo. echo Time format = %time% set "hh=%time:~0,2%" set "min=%time:~3,2%" set "ss=%time:~6,2%" echo. echo Timestamp1 = %date:~7,2%_%date:~4,2%_%date:~10,4%-%time:~0,2%_%time:~3,2%_%time:~6,2%
echo Timestamp2 = %date:~7,2%-%date:~4,2%-%date:~10,4%-%time:~0,2%_%time:~3,2%_%time:~6,2%
set Timestamp3=%dd%-%mm%-%yyyy%_%hh%-%min%-%ss%
echo Timestamp3 = %Timestamp3% Fix your capslock 1st...How about using the BB code tags.I'm fairly new to DOS..... so I have no idea what your reference to 'fix your capslock 1st' MEANS...
Be that as it may... I've done more testing and have solved my issue... thanks
Quote from: BRIANH on January 05, 2017, 03:38:04 PM I have no idea what your reference to 'fix your capslock 1st' means...
He means it is bad manners to type all in capital letters, as you did in the thread title. Doing that is the web equivalent of shouting (e.g. for attention). This has been so for around 20 years if not more.
|