Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run DOS commands in Windows 10 - use cmd /c commands.. #473

Closed
ck81 opened this issue Jun 27, 2019 · 7 comments
Closed

Run DOS commands in Windows 10 - use cmd /c commands.. #473

ck81 opened this issue Jun 27, 2019 · 7 comments
Labels

Comments

@ck81
Copy link

ck81 commented Jun 27, 2019

@kensoh, Tried to run a simple DOS command using TagUI in windows 10

run dir

It gives the error message:

Fatal Windows exception, code 0xc0000005.
PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.

Tried other DOS commands such as:

run copy c:\file1 to c:\file2

Same error message

Fatal Windows exception, code 0xc0000005.
PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.

For copy and move, I managed to have a workaround using the method you thought me earlier using phantomjs. However, would like to find out if TagUI can run DOS commands directly in Windows 10.

@kensoh kensoh added the query label Jun 27, 2019
@kensoh kensoh changed the title run dos command in windows 10 Run DOS commandS in Windows 10 - use command /c Jun 27, 2019
@kensoh
Copy link
Member

kensoh commented Jun 27, 2019

Hi CK, the run step can only run commands that exist. Eg if you have a program.exe then the run step can run it. But DOS commands don't exist, there is no copy.exe or move.exe for example. They are all loaded in memory as part of the command prompt. So to access these commands, you can try -

run cmd /c dir
echo run_result

@kensoh kensoh changed the title Run DOS commandS in Windows 10 - use command /c Run DOS commands in Windows 10 - use command /c Jun 27, 2019
@kensoh
Copy link
Member

kensoh commented Jun 27, 2019

Updated on typo above, should be cmd instead of command.

Windows has moved away from command.com for a long time 😅

@kensoh kensoh changed the title Run DOS commands in Windows 10 - use command /c Run DOS commands in Windows 10 - use cmd /c commands.. Jun 27, 2019
@ck81
Copy link
Author

ck81 commented Jun 27, 2019

Tried

run cmd /c dir
echo run_result

and

run cmd /c dir C:\Windows
echo run_result

Yes, it worked! But only for path without spaces

Tried the following, it didn't work:

run cmd /c dir C:\Program Files
echo run_result

No error message, but it shows the following:

 Volume in drive C is Windows10_OS
 Volume Serial Number is 30BC-5A12

 Directory of C:\


 Volume in drive C is Windows10_OS
 Volume Serial Number is 30BC-5A12

 Directory of C:\tagui\src

FINISH - automation finished - 0.4s

Tried the following too:

run cmd /c dir "C:\Program Files"
echo run_result

Error message:

The filename, directory name, or volume label syntax is incorrect.

@kensoh
Copy link
Member

kensoh commented Jun 28, 2019

As walkthrough earlier, the run step uses a CasperJS function to spawn OS-level processes. It's coded to interpret space as a separator between parameters. Thus having quotes around the folder name will not work.

The workaround is using the shorten Windows pathname which all Windows folder have. Eg 'Program Files' is 'progra~1' (first 6 characters of folder / file, followed by ~ and the running number depending on how many files with the same short name). That'll work!

@sheneeb
Copy link

sheneeb commented Sep 23, 2020

Hi Ck,
You mentioned how to copy and move files above, can you share here please ?

@kensoh
Copy link
Member

kensoh commented Dec 4, 2020

Sorry @sheneeb I was away the past few months - tebelorg/RPA-Python#144

You can use something like below, the normal Windows command prompt commands to copy and move files -

run cmd /c copy abc xyz
run cmd /c move abc xyz

@kensoh
Copy link
Member

kensoh commented Dec 4, 2020

Note that when the run step is used, the folder it runs the command is from tagui\src folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants