Reputation: 13168
I know I can split my VBScript into separate files and then include them all with one .wsf file. Something like this:
MyScript.wsf
<job id="MyJob">
<script language="VBScript" src="File1.vbs" />
<script language="VBScript" src="File2.vbs" />
<script language="VBScript" src="File3.vbs" />
<script language="VBScript" src="File4.vbs" />
</job>
C:\> cscript MyScript.wsf
But, is there a way that I can include a .wsf file, or some other grouping of .vbs files? This way I can treat a set of files as a unit, rather than having to list all of the files out individually.
Library1.wsf
<job id="Library1">
<script language="VBScript" src="File1.vbs" />
<script language="VBScript" src="File2.vbs" />
<script language="VBScript" src="File3.vbs" />
<script language="VBScript" src="File4.vbs" />
</job>
Library2.wsf
<job id="Library2">
<script language="VBScript" src="File5.vbs" />
<script language="VBScript" src="File6.vbs" />
<script language="VBScript" src="File7.vbs" />
<script language="VBScript" src="File8.vbs" />
</job>
MyScript.wsf
<job id="MyJob">
<script language="???" src="Library1.wsf" />
<script language="???" src="Library2.wsf" />
</job>
C:\> cscript MyScript.wsf
Upvotes: 0
Views: 71
Reputation: 13168
One way to do this that's a bit ugly but works is to concatenate partial files together using the type
command. cscript.exe
doesn't support piping though, so you have to use a temp file. Something like the following:
Start.txt
<job id="MyJob">
Library1.txt
<script language="VBScript" src="File1.vbs" />
<script language="VBScript" src="File2.vbs" />
<script language="VBScript" src="File3.vbs" />
<script language="VBScript" src="File4.vbs" />
Library2.txt
<script language="VBScript" src="File5.vbs" />
<script language="VBScript" src="File6.vbs" />
<script language="VBScript" src="File7.vbs" />
<script language="VBScript" src="File8.vbs" />
End.txt
</job>
C:\> type Start.txt Library1.txt Library2.txt End.txt > temp.wsf & cscript temp.wsf & del temp.wsf
Or I guess you could even kind of think of it like compiling:
build.bat
@echo off
type Start.txt Library1.txt Library2.txt End.txt > MyScript.wsf
Upvotes: 1