samintz
Scott Mintz
- May
- 1,590
- 27
Just for giggles and grins, I decided to try and see if this was remotely
possible.
I created two script files: part1.btm and part2.cmd
I enabled PathExt and removed .BAT from the PATHEXT variable.
I added an executable extension
.bat=part1.btm
Part1.btm:
cmd /c Part2.cmd %*
set /r foo
Part2.cmd:
@prompt
call %*
set > foo
Then I tested it by running a BAT script file I received from Raima that
sets up a build environment by setting a number of environment variables.
I also tested it running the vsvars32.bat script that comes with Visual
Studio.
It's crude, but it works. I don't remove any vars although an unset *
prior to the set /r should work. I don't know how to handle TITLE or CWD.
-Scott
samintz <> wrote on 05/05/2010 03:42:16 PM:
possible.
I created two script files: part1.btm and part2.cmd
I enabled PathExt and removed .BAT from the PATHEXT variable.
I added an executable extension
.bat=part1.btm
Part1.btm:
cmd /c Part2.cmd %*
set /r foo
Part2.cmd:
@prompt
call %*
set > foo
Then I tested it by running a BAT script file I received from Raima that
sets up a build environment by setting a number of environment variables.
I also tested it running the vsvars32.bat script that comes with Visual
Studio.
It's crude, but it works. I don't remove any vars although an unset *
prior to the set /r should work. I don't know how to handle TITLE or CWD.
-Scott
samintz <> wrote on 05/05/2010 03:42:16 PM:
> For those rare occasions when I have to run a BAT script written by some
> third party developer, 100% CMD compatibility is desired. Since this is
it> not possible due to the contrasting ways in which the parsers function,
any> would be a really nifty feature to run the BAT script in CMD but have
Changes> environment variables or directory changes propagated back to TCC.
what> to TITLE would be a nice touch too.
>
> I'm not exactly sure how this could be done, but here's an idea:
>
> Since CMD will inherit the environment from TCC when launched we know
is.> the initial environment is and what the current drive/directory status
which> run the BAT script in CMD
> compute a differences file with what changed in the environment and
file.> directories changed.
> Apply those changes to TCC.
>
> A function called SNAPSHOT could save an initial copy and a second call
> could compute the delta.
> TCC could invoke a BAT file by enveloping it inside another BAT/CMD
>
> TCC would invoke the user script by: CMD /c Compatibility100.CMD
> users.bat arg1 arg2 arg3...
>
> Compatibility100.CMD:
> TCC /c SNAPSHOT
> call %*
> TCC /c DELTA
>
> -Scott
>
>
>
>