cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Any way to set Working Directory at startup?

SOLVED
ptc-4892285
1-Newbie

Any way to set Working Directory at startup?

We use Creo Parametric with Windchill PDMLink. Creo is set to "start in" a folder named "Config". This is where my config.pro, appearance files, lighting files, etc. are kept. I like to keep that folder free of clutter.

 

Is there a way to automatically have my Working Directory set to another location when I start the program? If I leave it set to Config & start working in a linked session with WC, all sorts of log files, BOM files, etc. get written to my Config folder. To avoid this I've made a practice of changing my Working Directory whenever I start Creo. Surely there must be a way around this?

 

Thanks for any help.


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
1 ACCEPTED SOLUTION

Accepted Solutions

Thank you for the detailed response. I will try your method 2 using the trail file. It sounds like that should accomplish what I'm after.

View solution in original post

10 REPLIES 10

Perhaps there is simpler method but I know of two ways to accomplish this; by having creo run a set of commands upon startup or before Creo startup via a batch file. If it's the former, by the time Creo has loaded and sets the working directory, it may have already created some clutter files based on errors it finds in the config file, etc. Hence the reason I say below to create a "backup" location for your config files. Here are the two methods:

Method 1:

  1. Keep your config files in a separate backup location
  2. Create a batch file that deletes the contents of your "config" folder and copies the contents of this backup folder to that location before it runs the creo parametric command.

Pros:

  • Copying files is handled before creo starts and error/temp files are created
  • Your "config" folder is always clean upon starting a new session of Creo
  • You always have a backup of your config files

Cons:

  • If you are troublshooting a session of Creo be sure to look at the error files before they are deleted at the next session. I also suggest to keep you trail files in a separate, local directory.
  • It could be problematic if you attempt to run multiple sessions of Creo with the same batch file.

Method 2:

  1. Keep your config files in a separate backup location, your "config" folder becomes the trash bin.
  2. Run the creo parametric command with some startup commands that automatically loads your config file and points to the backup location for all of your color files, tree configs, etc. Alternatively you could keep your config files within your "config" directory and have it just change the working direction upon startup (junk files may still be created).

Pros:

  • Automates a bunch of stuff on startup so you can have it do more than just set the working directory, load config files, etc. You could even have multiple configs: one for company standards, one for personal customizations, and yet another for mapkeys.
  • Your "config" folder becomes the defacto dumping grounds...perhaps rename it, and your backups location with your config files is safe.

Cons:

  • A little tricky to set up but not difficult.

Personally, I use Method 2 and it works great.

Method 1 is straight forward - have your startup icon point to a batch file that runs what commands you want and then starts Creo. A method 1 batch file might look something like this (or you could just modify your parametric.bat to the following):

@echo off

delete "your dumping ground folder path here"

copy "your backup path here" "your dumping ground path here"

start "" "YourPathOrEnvironmentVariableHereTo\Parametric\bin\parametric.exe" "YourPathOrEnvironmentVariableHereTo\Parametric\bin\parametric.psf" %*

exit

Finally, change the target of your Creo icon to this batch file. Double check your parametric.bat doesn't already have any other commands that you might need to add.

For method 2, first you need to start a normal session of Creo by doing things you typically do at startup i.e. loading a config file, changing working directory, closing the browser, minimizing the UI toolbar, etc etc...anything you want automated. Then copy your trail file of the session you just started to a safe location and rename it Creo-startup.txt or something you prefer.

Now create a batch file called Creo-Startup.bat and enter the following lines:

@echo off

start "" "YourPathOrEnvironmentVariableHereTo\Parametric\bin\parametric.bat" YourPathTo\Creo-Startup.txt %*

exit

Finally, change the target of your Creo icon to this batch file. This assumes you have a parametric.bat that runs your parametric.exe file. If not, you can create one similar to method 1 above but without the delete and copy lines.

Upon startup it will run everything in the trail file you created, almost like a giant mapkey. We use it to load multiple configs and to close a few standard dialog boxes, etc. Hopefully that makes sense; post again if you get stuck.

Thank you for the detailed response. I will try your method 2 using the trail file. It sounds like that should accomplish what I'm after.

View solution in original post

Yes, your 2nd method works great. Nice & simple. Thanks.

Question though: What does the "%*" at the end of the start command line do?

Batch files are limited in how many parameters they can pass as an argument. %* allows all parameters to be output. I've never tried omitting the %* but I suspect you won't get much of the trail file processed.

OK thanks.

Hello all,

I coming back on this old conversation as i'm using method 2 since a long time (proe5)

and it was working well .. I did follow the method on creo 2 and 3

see my start.bat file :

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

del "C:\install_PTC\CREO3\Creo 3.0\m060\Common Files\text\config.pro"

del "C:\install_PTC\CREO3\Creo 3.0\m060\Common Files\text\*.ui"

copy "D:\02_PROE_CONFIG\Config_creo3\00_start_file\config.pro" "C:\install_PTC\CREO3\Creo 3.0\m060\Common Files\text"

copy "D:\02_PROE_CONFIG\Config_creo3\00_start_file\*.ui" "C:\install_PTC\CREO3\Creo 3.0\m060\Common Files\text"

start C:"\install_PTC\CREO3\Creo 3.0\m060\Parametric\bin\parametric.exe" set_up_file_affaire_EC15042.txt

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

But now since I upgrade on creo 3 M050, i meet the following problem :

the start up file is running correctly, the config.pro seems to be applied as all colours and so on are correct,

but the mapkey are not running anymore ..!

i did the test without the "set_up_file_affaire_EC15042.txt" and everything is fine .!

what is done in the .txt file is setting the working directory and open the main asm.

by the way, i apply a sarch path file called "config.pro" placed in the start directory set in the start icon.

I don't understand what's happening ??? if anyone as an idea

thanks in advance

Alexandre

MartinHanak
23-Emerald V
(To:ECMA)

Hi,

I guess, set_up_file_affaire_EC15042.txt is trail file. Did you try to play it from Creo session manually ? What happened in such case ?

MH


Martin Hanák

It looks like you have a solution that you like, but I thought I'd add some more info for your consideration.

Creo looks for config files in 3 places at start up:

  1. The text folder in the Creo installation (typically C:\Program Files\PTC\Creo 2.0\Common Files\[build]\text)
  2. The user's home directory
  3. The 'start in' folder.

The last one, where your configs reside, is also set as the initial working directory. You could set that as your preferred initial working directory and put your configs in one of the other two places. The text folder gets overwritten when Creo is upgraded, so be careful storing them there. It's better to use a batch file to copy them there from another location.

--
Doug Schaefer | Experienced Mechanical Design Engineer
LinkedIn

Thanks for the alternative suggestion Doug.

If its just the working directory you are wanting switched. If you use a shortcut icon, go to the properties of the shortcut, and in the "Start in:" text box designate the location you want your working directory to be.

Announcements