最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

shell - How to use VS2022 ${workspaceRoot} in Developer Command Prompt For VS 2022 Window - Stack Overflow

matteradmin6PV0评论

I am Using VS 2022 for cross-platform development of Linux executables, with compilation/linking occurring on a Linux server.

I have CMakeSettings.json configured to Copy build output back to the local machine, where local machine is Windows10 running VS 2022.

The back copied build output files are at: C:\Users\<UserId>\CMakeBuild\${workspaceHash}\build\Linux-Debug.

For local workflow reasons I want to use Command Prompt Window (or PowerShell window) shell scripts or batch files to copy files around. For example:

copy C:\Users\<UserId>\CMakeBuild\${workspaceRoot}\build\Linux-Debug\*.* c:\Temp\Example\*

So, questions:

  1. How does Command Prompt Window access/expand ${workspaceRoot}? I tried copying ${workspaceRoot} into a command, that doesn't work.
  2. Is there some way for Command Prompt Window to get the value of ? I'm trying to develop scripts usable by several people, all with different UserIds. I'd rather not have them enter their UserId as a script parameter if I can avoid it.
  3. What is a construct like ${variableName} called?

Part of my problem here is I don't know the proper vocabulary for some of this, so it's hard to find the answer.

The results I got were: dir C:\Users\UserId\CMakeBuilds\${workspaceRoot} yields File Not Found

dir C:\Users\UserId\CMakeBuilds\%workspaceHash% yields File Not Found

dir C:\Users\UserId\CMakeBuilds\guid string yields folder contents

I don't want users having to enter a UserId or guid into the path string. I want that data automatically inserted into the path string.

Post a comment

comment list (0)

  1. No comments so far