2

How can I get the last run command as a string and store it? say suppose:

Step1:XYZ.exe parm1 parm2
step2:If(condition true){do something}
Else {string lstcmd = XYZ.exe parm1 parm2}

I need to get the XYZ.exe parm1 parm2 as a string, so that I can use this small piece of code for every command I run.

1 Answer 1

2

If you want it as a string, just save it in a variable.

SET "THECMD=XYZ.exe parm1 parm2"
%THECMD%
If (condition true) {do something}
Else {ECHO %THECMD%}
1
  • Ok. Thanks.Looks like this will work for me. Lemme try and will let u know. Thanks!!
    – Reema
    Commented Jul 11, 2017 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.