for-each
for-each

Reputation: 679

Batch file: Open cmd, run VS Command Prompt, execute Makecert

I need to do this in a batch file:

  1. Open cmd
  2. Run VS Command Prompt via cmd
  3. Execute this command "makecert -sv SignRoot.pvk -cy authority -r sha1 -a -n \"CN=Certificate\" -ss my -sr localmachine certificate.cer"

So far, I've done 1 and 2, my problem is getting into #3.

Here's what I have so far.

start  cmd.exe /k "%comspec% /c  "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86"

Upvotes: 1

Views: 11954

Answers (2)

mfarouk
mfarouk

Reputation: 654

actually, visual studio command prompt is not a special command prompt, it is the normal windows CMD but configured with some environment variables

to make the same effect in a batch file you will need to call a special batch file from visual studio installation to configure windows CMD

to do so, the very first line in your batch file should be

call "%VS120COMNTOOLS%\vsvars32.bat"

then you can call any visual studio specific command

VS120COMNTOOLS is the path environment variable for your visual studio version

Upvotes: 0

gremwell
gremwell

Reputation: 1457

This is what I've done to open up a Qt 5.0.2 command prompt with VS2012 setup and my own batch file run:

C:\Windows\System32\cmd.exe /A /Q /K C:\Qt\Qt5.0.2\5.0.2\msvc2012_64\bin\qtenv2.bat & call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x64 & cd c:\tkbt\Launch2.0.0 & call SetupEnvVars.bat

Drops me in the right spot with all the environment variables all set up.

So the answer to your question is to append your next call after an "&"

Upvotes: 1

Related Questions