Hi All,
Can anyone guide on what are the best practices and steps to work with with windows command prompt in studiox, Appreciate your help.
Thanks
Mayur
Hi All,
Can anyone guide on what are the best practices and steps to work with with windows command prompt in studiox, Appreciate your help.
Thanks
Mayur
Welcome to the community,
When working with Windows Command Prompt in StudioX, here are some best practices and steps to follow:
Overall, it is important to carefully design and test your Command Prompt workflows to ensure that they are reliable and produce the desired results. It is also recommended to use error handling and logging mechanisms to track the execution of your workflows and troubleshoot issues when they occur.
Regards,
Vasanth kumar
Hi Vasanth,
as per step 1 I could not find the command prompt activity in studio x. can you please assist.
Thansk
Mayur
Welcome to the community
I dont think there is a cmd activity as such…as mentioned above
You can sue Use Application/Browser and pass the bat file directly to run the file in cmd…
It is not advised to use ui activities on command prompt
hope this helps
cheers
Hi Anil,
Thank you, but with above steps am unable to run batch file, also when i execute a command i need to wait until the command is finished so how do i make sure the run is completed is there a way to read value from cmd and validate in studio x.
appreciate your help.
thanks
Mayur
Ideally you should be able to do it…I tried it from my end…you can change the use application options in properties for close to never and also include a echo or pause and check it should show you cmd…
From the cmd windows its difficult to identify…as a work around you can use a script to add value failed or success to a text file in the batch script and then read the text file to know the outcome…
You can check text file in a loop if the batch script takes so much time to check the text file in every time interval
Hope this helps
Cheers
A better way than the Use Application
activity would be to run cmd
from the Invoke Powershell
activity.
To do this, the format to use is:
cmd.exe \c "your cmd command here"
In this example, I’m running the cmd
command dir
and writing it to a text file:
The benefit of this method is that you don’t have to use a UI window at all. If you did, you’d need to poll it to figure out if the command is finished, which is less robust.
Hi Ethan,
Thank you ! but this ask is for studio x platform which do not have the cmd or invoke PowerShell activity.
Thanks
Mayur
Hi Anil,
Thanks much, I could run the batch file and execute the commands as next steps to capture the cmd output if its completed or not as you recommended i have created a script which will write success or error post completion.
Now the challenge is in order to implement the loop logic (Check if the text file has value success if yes exit the loop or else wait 20 sec and check again)
I could not find for loop or while loop activity in studio x can you recommend any alternate way to achieve this loop logic.
I highly appreciate your help with this.
Thanks
Mayur
You can use a for each with number of times as 50 or so…and inside that use the condition to end the loop if success else wait for 20 seonds…so effectively it check for 20 seconds and maximum of 50 loops
Hope this helps
cheers