Opening A File With Inventor (Read Only) From the Command Line

Opening A File With Inventor (Read Only) From the Command Line

Anonymous
Not applicable
2,196 Views
10 Replies
Message 1 of 11

Opening A File With Inventor (Read Only) From the Command Line

Anonymous
Not applicable

I want to open an .ipt or .iam with InvRO.exe (Inventor Read Only) from the command line. 

 

I can open Inventor from the command line. I can open the file from the command line but it defaults to the full version when it opens. I know I can change the file types to always open with the Read Only but I want to leave them as is.

 

How do I launch InvRO.exe from the command line and have it open a specified app?

0 Likes
Accepted solutions (2)
2,197 Views
10 Replies
Replies (10)
Message 2 of 11

mdavis22569
Mentor
Mentor

Unfortunately it's not that easy. 

 

Like would need to have the Read Only open and pick it... 

 

but if you're file type is set to the Inventor.exe and not the Read only it's going to default that


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------
Mike Davis

EESignature

0 Likes
Message 3 of 11

Anonymous
Not applicable

If the Read Only is open, can I attach to it?

0 Likes
Message 4 of 11

mdavis22569
Mentor
Mentor

You should be able to just open it from Read Only then ... not double clicking in Explorer


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------
Mike Davis

EESignature

0 Likes
Message 5 of 11

pball
Mentor
Mentor

@Anonymous 

 

I can get Inventor 2020 Read-only to launch from the command line using the path below in the CMD prompt.

 

"C:\Program Files\Autodesk\Inventor 2020\Bin\InvRO.exe"

 

Adding a file path behind that will open the file in Inventor Read-only.

 

"C:\Program Files\Autodesk\Inventor 2020\Bin\InvRO.exe" "C:\path to\some\File.ipt"

 

Using the full command a second time opens a second instance of Inventor Read-only. But it seems using just the file path will cause it to open the previously opened Inventor Read-only.

Check out my style edits for the Autodesk forums
pball's Autodesk Forum Style
Message 6 of 11

freesbee
Collaborator
Collaborator

@Anonymous wrote:

How do I launch InvRO.exe from the command line and have it open a specified app?


If you do not want to change file associations to invRO you need a little bit smarter code to achieve that: I have an idea in my mind, and I think it could work. Unfortunately it's too late on this side of the ocean, and tomorrow I have a very dense day, but on Wednesday I'll verify if my idea works and I will write you the code you need.

Give me a couple of days... (this post is actually useless 🤣, but if I didn't post I would risk to lose your question)

Massimo Frison
CAD R&D // PDM Admin · Hekuma GmbH
Message 7 of 11

Anonymous
Not applicable

You are right, that is working from the Command Line.

 

I am trying to replicate that with VB.Net Process

 

Process.Start("C:\Program Files\Autodesk\Inventor\Bin\InvRO.exe", "C:\Some Path\Some File.ipt")

But it won't open the file...just the application. 

0 Likes
Message 8 of 11

freesbee
Collaborator
Collaborator
Accepted solution

...so this is the solution to the question you have originally stated:

"opening a file with Inventor ReadOnly from the command line"

Now you have changed your request a little bit, so if you mark my answer as solution I will be glad to support you in your new task of

"opening a file with Inventor ReadOnly from a VB.net executable"

(you know: my Autodesk mentor told me that I need "solutions"...).

Assumptions

I will assume the followings:

  1. Inventor is on the 2020 release, and installed in the default folder (as stated above in the other posts)
  2. Inventor ReadOnly is already initialized on your system and in the active userprofile
  3. your ipj file is correct and properly loaded

I hope I didn't forget anything 🤔

The logic

As you already realized if you call the invRO.exe passing a FQFN of an inventor file, that file will be opened in Inventor ReadOnly. The problem is that, if you do it again, another instance of Inventor ReadOnly will be opened, and you do not want this. The batch code I am giving you will first check if inventor ReadOnly is running, and then decide how to handle the argument you have passed: inventor ReadOnly will be launched if needed, or simply the file will be opened.

How TO

You can easily achieve what you have asked if you place a properly crafted cmd file in your "C:\Windows\System32" folder, or in any other folder included in the path. If you do not want to place the file in a path folder, then the only difference will be that you will need to call the cmd file with full qualified file name.

Usage

In my computer I have created the C:\Windows\System32\InvRO.cmd

Then I simply need to enter in the commandline the following

C:\> invro D:\CAD\myPart.ipt

and the inventor file myPart.ipt will be opened in Inventor ReadOnly without changing file associations.

 

Be aware to wrap the filename in quotes in case you have spaces inside, otherwise the interpreter could misinterpret the argument, assuming that 2 arguments are passed:

C:\> invro "D:\CAD\my Part.ipt"

will work, while

C:\> invro D:\CAD\my Part.ipt

will almost for sure fail

The InvRO.cmd file

Leaving away bells and whistles, I have simply written the bare code you need to achieve what you have asked. You can freely adapt to your specific needs.

tasklist | find /I "InvRO.exe" >nul 2>&1 && (
 "%~1"
) || (
 start "%ProgramFiles%\Autodesk\Inventor 2020\bin\InvRO.exe" "%~1"
)
:EOF

Additional Considerations

With some additional effort it would be possible to control the active ipj from the batch file, but since you have already indicated that you need to realize a little bit different task, I think this can be considered a valid solution for your current question, and we'll see in the future how to handle the other task.

I hope this is a solution to your question.

Massimo Frison
CAD R&D // PDM Admin · Hekuma GmbH
Message 9 of 11

Anonymous
Not applicable

Awesome answer. Thanks for the information. 

 

Since my question has evolved, should I start a new thread or continue in this one?

0 Likes
Message 10 of 11

freesbee
Collaborator
Collaborator
Accepted solution

...start a new one with the proper title, but now I'm sorry: I have some guests for dinner and I need to prepare their dinner.

But I'll be here around again 😉

Massimo Frison
CAD R&D // PDM Admin · Hekuma GmbH
Message 11 of 11

freesbee
Collaborator
Collaborator

...now we have an idea to vote to have an Inventor ReadOnly API exposed.

If this idea is implemented, the limitations discussed up here will be addressed, so vote up!!

Massimo Frison
CAD R&D // PDM Admin · Hekuma GmbH