Sending commands to Windows cmd.exe

I’m looking to use the command prompt to move a directory into another directory. I’m currently using a Open Application activity followed by a Type Into Activity to send the command. I notice that the typing into the activity is slow since the directory paths are long. Is there any way to do this faster? I’m not sure if it can be done with a Start Process activity, if so how do I pass the command string and execute it?

@Vitamin_D Yes, you can use Start Process. There is a 2nd line for Arguments, you can add your arguments in here. Type it in as a string

For your type into, make sure you have ‘SimulateType’ checked. That will make the typing more or less instantaneous.

You can also use the invoke powershell activity to run commands instead of opening CMD.exe

Not having to open the cmd.exe would be even better. However using the invoke power shell activity throws the following error:

Source: Invoke Power Shell (Throw)

Message: The term ‘Move “C:\Users\username\Desktop\file name” “C:\Users\username\Documents\applicationFolders\Exceptions”’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Exception Type: System.Management.Automation.CommandNotFoundException

The command string I’m passing to it looks like this:

“Move " + “””" & selectedFolder & “”"" + " " + “”"" & exceptionsFolderPath & “”""

Make sure the ‘IsScript’ checkbox is checked in the activity properties

3 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.