It's all about the answers!

Ask a question

Running batch script with two lscm commands causes finishing script just after finishing first command


nanda S (201619) | asked May 23 '14, 4:25 a.m.
edited May 23 '14, 5:25 a.m. by Krzysztof Kaźmierczyk (7.5k480103)

I am trying to execute two or more lscm command by storing it as a batch file.

If i try exectue the two commands in separate lines execution for the first command happens successfully and stops for the execution of the second command

it works only when i add "&&" between two commands  but i want each command to be in a new line and execute.  

Example:

NOT WORKING

lscm create workspace -r https:\\Xyxyxy -u User -p password workspaceName1

lscm create workspace -r https:\\Xyxyxy -u User -p password workspaceName2

WORKING

Example

lscm create workspace -r https:\\Xyxyxy -u User -p password workspaceName1&&lscm create workspace -r https:\\Xyxyxy -u User -p password workspaceName2

Accepted answer


permanent link
Lily Wang (4.9k714) | answered May 23 '14, 4:48 a.m.
On Windows lscm itself is a batch command. To call it in a batch file, you may need to use:

call lscm create workspace -r https:\\Xyxyxy -u User -p password workspaceName1
call lscm create workspace -r https:\\Xyxyxy -u User -p password workspaceName2
nanda S selected this answer as the correct answer

Comments
nanda S commented May 26 '14, 4:49 a.m.

Thank you ,It worked!

One other answer



permanent link
Krzysztof Kaźmierczyk (7.5k480103) | answered May 23 '14, 4:59 a.m.
Hi Nanda,
I am assuming that you are using Windows. I was also able to reproduce this issue on Windows.

The work around is to use scm instead of lscm command. This will work for you then.

Comments
sam detweiler commented May 23 '14, 12:57 p.m.

or as Lily mentioned, use Call


nanda S commented May 26 '14, 4:49 a.m.

Thank you ,It worked! 

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.