SHELL command output

SHELL command output

kazfukuoka
Enthusiast Enthusiast
1,223 Views
9 Replies
Message 1 of 10

SHELL command output

kazfukuoka
Enthusiast
Enthusiast

When I run SHELL command, output from the command is not shown.
For example, if I type "shell echo hello world", it goes like this.

Command: SHELL
OS Command: echo hello world

Here, the string "hello world" was discarded.

Also if I type "shell nosuchcommand", it gies like this.

Command: SHELL
OS Command: nosuchcommand

Here, the error message was not printed.
Is there any way to see those messages?

 

[additional info]
It is hard to debug a command script file because
AutoCAD throws away error messages.
I am hoping AutoCAD is saving those messages somewhere.

 

[in summary]
When "SHELL nusuchcommand" is executed,
Windows prints error message saying "No such command."
But the error message is swallowed by AutoCAD,
and there is no way to know the command was bad.
I am wishing there is a way to see the error
when the script (.scr file) runs.

0 Likes
1,224 Views
9 Replies
Replies (9)
Message 2 of 10

paullimapa
Mentor
Mentor

At OS Command prompt hit Enter to exit into DOS box and then you type Echo Hello World


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 10

kazfukuoka
Enthusiast
Enthusiast

Thank you for the info.
That surely works for manual operations.

 

I was not clear, but I am asking for debugging a script file.
I am wishing a trick to see the lost error messages.

0 Likes
Message 4 of 10

paullimapa
Mentor
Mentor

try displaying Text Screen with command TEXTSCR

then use an alert to popup a window to pause the script like: (alert"Stop")

If you have more than one monitor then you can first position the text screen on the other monitor before running the script or while the alert box is up press Alt+Tab to get to the text screen to see any error messages.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 10

cadffm
Consultant
Consultant

Are you talking about a *.scr file in acad/acadlt.exe?

..all you need is your LOGFILE [F2], or?

 

 

and if your Script contain Lisp-(Command statements, make sure CMDECHO is on (1)

 

 

 

Sebastian

Message 6 of 10

kazfukuoka
Enthusiast
Enthusiast

I appreciate the info.
But the discussion is going away from what I want.

In short, what I want is this:
Suppose there is a following line in .scr file.

SHELL TYPE nosuchfile

This is a bad command. Windows should print a error message
saying "there is no such file."

However, this error message is not printed anywhere.
Without seeing the error, it is difficult to tell where things went bad.
I want a way to see the error message when the script runs.

0 Likes
Message 7 of 10

paullimapa
Mentor
Mentor

this has to do with the way the SHELL command is coded in the acad.pgp file which can be found under your windows profile roaming autocad support:

C:\Users\windows-profile\AppData\Roaming\Autodesk\AutoCAD 2020\R23.1\enu\Support\acad.pgp

by default, the SHELL command is not coded in the acad.pgp to exit to the DOS box for you to see the error messages:

SHELL, , 1,*OS Command: ,

Of course you can change that setting to something like:

SHELL, , 0,*OS Command: ,

but it'll only impact the station where you made the change.

you can read up on the external command parameters here:

https://help.autodesk.com/view/OARX/2023/ENU/?guid=GUID-4CE44766-E856-47D4-93E6-D45A3EC6749Bon 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 8 of 10

kazfukuoka
Enthusiast
Enthusiast

Thank you for the info.
Then, I think the summary goes like this:

- AutoCAD throws away stdout and stderr messages of SHELL commands.
- There is no user-friendly switch to change this behavior.
- "Do not cause error in SHELL command; otherwise...." is the rule.

 

# Thanks to all the people who provided answers.
# I learned lots of interesting things by asking.

0 Likes
Message 9 of 10

wanijsena92
Community Visitor
Community Visitor

I am having trouble with the shell command in AutoCAD 2020. It works perfectly fine on one cylinder but when I try on another cylinder it does not work and gives an error code of 97026. Please help https://vidmate.onl/!

0 Likes
Message 10 of 10

pendean
Community Legend
Community Legend
Use it on a cylinder? not sure what that means, sorry. Can you elaborate?
0 Likes