1

Below is my batch script :

@echo off

cd "C:\Users\SXR1176\AppData\Roaming\npm"

set /p Product= Enter Product : 
set /p Organization= Enter Organization :  
set /p Server= Enter Server: 

echo Product %Product%  

echo Organization %Organization%  

echo Server %Server%  

cmd /k apic login 

cmd 

apic drafts:pull %Product%  --organization %Organization% --server %Server% 

pause

The output of the above batch file is below :

Enter Product : sendfax-from-dev-faxutilitywsdl-product:1.0.0

Enter Organization :  demoOrg

Enter Server: dummyserver.com

Product sendfax-from-dev-faxutilitywsdl-product:1.0.0

Organization demo

Server dummyserver.com

Enter the API Connect server
? Server: dummyserver.com
? Username: username
? Password (typing will be hidden) *******
Logged into dev-apic.humana.com successfully

C:\Users\SXR1176\AppData\Roaming\npm>

I see after the apic login command , the next command (apic drafts) is not executed at all . Could you please let me know what is happening .

Squashman
  • 13,649
  • 5
  • 27
  • 36
user1117723
  • 153
  • 2
  • 10
  • 1
    It didn't work b/c you basically started a new shell right after the login (i.e. you ran `cmd`). That would cause the script to stop and wait for the user to do something. – Matt Hamann Feb 17 '18 at 19:37

1 Answers1

2

Not sure why you do the cmd /k and the odd cmd but give this a try:

@echo off
cd  /d "C:\Users\SXR1176\AppData\Roaming\npm"

set /p "product=Enter Product : "
set /p "organization=Enter Organization :  "
set /p "server=Enter Server: "

echo Product %product%
echo Organization %organization%
echo Server %server% 

call apic login
call apic drafts:pull %product%  --organization %organization% --server %server% 
pause

Then that said. I am a bit uncertain about what needs to happen here. I do not have apic so I cannot replicate the issue so let us see how it goes with the answer. I suspect that apic might be outside of the cmd scope.

Gerhard
  • 22,678
  • 7
  • 27
  • 43
  • thank you for your response Gerhard . Basically before executing the apic login or apic drafts , I need to be in this directory --> C:\Users\SXR1176\AppData\Roaming\npm . apic login will login to the API connect server (need to give the server name , username and password) . Once I have logged in , I want to pull a product from the API connect server . – user1117723 Feb 16 '18 at 21:19