We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 55743

Vivado - How can I find the Working Directory and project directory in the Vivado IDE or in a Tcl script?


1) Is there a method to obtain the full path to the current working project in the Vivado tool? Often times, the project is buried quite deep in a particular directory hierarchy, and it is convenient to be able to find the complete path to the project root directory location in order to open a file explorer window into that directory.

I have noticed that issuing pwd or dir commands within the Tcl Console gives the application launch directory (e.g., C:/Users/joesmith/AppData/Roaming/Xilinx/Vivado). And, the current_project Tcl command only gives the project name, not full path.

2) Is there a way to change the current working directory (CWD) to the location of the current project? I would like to generate reports or have the auto generated reports and log files created in the project directory.

3) In Vivado, the working directory can be determined by issuing a pwd command at the console, but when I try to run a tcl.pre script before a run (e.g., Implementation/Synthesis) the tools cannot find my relative path to the script and the following error is issued:

ERROR: [runtcl-1] couldn't read file "<file>": no such file or directory
ERROR: [runtcl-2] sourcing script <location> failed

Does my working directory change during Synthesis/Implementation Runs?


1) Following are some ways to determine the project directory location:

    • Use the Tcl command "get_property DIRECTORY [current_project]"
      • Optionally, this command could be added as a custom command via the Tools > Custom Commands menu to give quick access to the directory location. see (Xilinx Answer 57910).
    • If you want to show files generated for a run, you can also simply select that run in the Design Runs tab, right click on it, and select Open Run Directory. This will open OS file Browser set to that run directory. Note that this option is only selectable once a run has been completed (or in progress)
    • Opening the File->Save As dialog, and copy the Project location field, and then append the project name.

2) Some ways of changing the CWD to the current project directory are listed below:

  • Invoke Vivado tools from command line while in the project directory .
  • Double-click on the .xpr project file in Windows Explorer. This will open the project in Vivado IDE and the project directory will be used as the working directory.
  • A command to CD to the current project directory could be added as a proc in the init.tcl file.
    • Example: after adding the following proc to the init.tcl, a user can type cdp from the Tcl console to change the CWD to the project t to the current working directory.
      proc cdp { } {
      cd [get_property DIRECTORY [current_project]]
    • One user suggests creating a button (Tools > Custom Commands) to generate report files.
      set work_directory [get_property DIRECTORY [current_project]] ; cd $work_directory ; puts -nonewline "Changing Directory to " ; pwd

      See also (Xilinx Answer 55459)

3) In Vivado Project-Mode, during a Synthesis run or an Implementation run, the Vivado working directory temporarily changes to the "project_name/project_name.runs/run_name" directory. After the run finishes, the working directory then changes back to what it was before. This can be verified by running a pre.tcl script with the following commands and then verifying the output in the runme.log file

set test [exec pwd]
puts "$test"
AR# 55743
Date Created 04/26/2013
Last Updated 11/08/2013
Status Active
Type General Article
  • Vivado Design Suite