How create batch file using Windows SDK Command Prompt?

R

Ronald S. Cook

Currently (manually), I 1) open a Windows SDK Command Prompt and 2) navigate
to a particular folder. Then I 3) type a command and press enter. The
command is irrelevant (WCF-related) but here it is FYI:

svcutil http://localhost/COWFeedyardService/Services/Pen.svc /out:pen.vb
/config:App.config /language:VB

All works fine, but I need to do this over a hundred times changing "Pen" to
the names of the other classes and re-executing.

QUESTION: How can I create a batch file that I can list all the lines in and
have it run them under the Windows SDK Command Prompt?

svcutil http://localhost/COWFeedyardService/Services/Pen.svc /out:pen.vb
/config:App.config /language:VB
svcutil http://localhost/COWFeedyardService/Services/Lot.svc /out:Lot.vb
/config:App.config /language:VB
svcutil http://localhost/COWFeedyardService/Services/Animal.svc
/out:Animal.vb /config:App.config /language:VB
etc...

Thanks,
Ron
 
N

Nicholas Paldino [.NET/C# MVP]

Ronald,

You don't need to have it run under the Windows SDK Command Prompt. Why
not just include the full path to svcutil? That's really all you need.
That, and you need to specify a full path for the out and config parameters
as well, but that's a simple task.

Hope this helps.
 
J

John Vottero

Ronald S. Cook said:
Currently (manually), I 1) open a Windows SDK Command Prompt and 2)
navigate to a particular folder. Then I 3) type a command and press
enter. The command is irrelevant (WCF-related) but here it is FYI:

svcutil http://localhost/COWFeedyardService/Services/Pen.svc /out:pen.vb
/config:App.config /language:VB

All works fine, but I need to do this over a hundred times changing "Pen"
to the names of the other classes and re-executing.

QUESTION: How can I create a batch file that I can list all the lines in
and have it run them under the Windows SDK Command Prompt?

Call SDKVARS.BAT from your batch file.

You can right click the "Windows SDK Command Prompt" shortcut to see what
it's really doing, look at the target.
 
R

Ronald S. Cook

So would you guys create the batch file in Notepad or something? I keep
hearing about "PowerShell" but not sure how to work with that.

Thanks for any ideas.
 
J

John Vottero

Ronald S. Cook said:
So would you guys create the batch file in Notepad or something? I keep
hearing about "PowerShell" but not sure how to work with that.

PowerShell is MUCH better than batch scripts. It sounds like you're new to
batch scripts and PowerShell, if so, your time would be better spent
learning PowerShell.

You can use Notepad or any other text editor to create a PowerSell script.
You could also use one of these PowerShell specific editors:

http://www.powershellanalyzer.com

http://www.powershell.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top