Task Sequence variables and batch file
hi all experts,
just wondering if there is an easy way to pass on the TS variables into a batch file. I have a working Run Command Line step on my TS as follows:
cmd.exe /c "set tsname=%_SMSTSPackageName% & .\mybatchfile.bat"
This is ok when only passing on 1 variable, but not with many variables as you can imagine. '
Any idea of any other way that fits in with multiple variables scenario?
Thanks,
Xm
November 6th, 2012 4:32am
November 6th, 2012 8:43am
thanks Niall, but not sure how the link above relates to my question - would you mind to shed some light?
November 6th, 2012 10:42pm
I *think* what Niall is getting at is to use a VBScript instead (or some other COM aware tool) or asking why are you wanting to do this? Knowing why often helps us help you.
November 7th, 2012 1:18am
if it was the case then the reason I want to do this is that because we have quite a lot of batch files that it would take a lot of time if I was having to convert to VBscript etc. So the easiest way I think is to get those SCCM variables that I need and
put it in the existing batch files script to work with.
November 7th, 2012 7:07am
I do have workarounds to those which I've been using i.e. one of them is the command line that I mentioned above. However, it's the fine-tuning time, so I'm trying to make the scripts run better.
-
Edited by
xmen11
Wednesday, November 07, 2012 7:10 AM
November 7th, 2012 7:10am
I do have workarounds to those which I've been using i.e. one of them is the command line that I mentioned above. However, it's the fine-tuning time, so I'm trying to make the scripts run better.
-
Edited by
xmen11
Wednesday, November 07, 2012 7:10 AM
November 7th, 2012 7:10am
I do have workarounds to those which I've been using i.e. one of them is the command line that I mentioned above. However, it's the fine-tuning time, so I'm trying to make the scripts run better.
-
Edited by
xmen11
Wednesday, November 07, 2012 7:10 AM
November 7th, 2012 7:10am
I do have workarounds to those which I've been using i.e. one of them is the command line that I mentioned above. However, it's the fine-tuning time, so I'm trying to make the scripts run better.
-
Edited by
xmen11
Wednesday, November 07, 2012 7:10 AM
November 7th, 2012 7:10am
Using the same method that you posted this is what I did for use of multiple variables. This is how I tested to see if it would work as expected.
Run Command as follows.
cmd.exe /c "set deployroot=%computername% & set scriptroot=%username% & C:\runme.bat"
Runme.bat file.
@echo off
echo %deployroot%
echo %scriptroot%
pasue
Results
ITW764MASTER
username
press any key to continue...
April 3rd, 2015 3:07pm