简体   繁体   English

Cygwin在路径中使用我的Windows用户名?

[英]Cygwin to use my windows username in path?

I'm writing a script where Cygwin needs to cp a file from my desktop. 我正在编写一个脚本,其中Cygwin需要从我的桌面上cp一个文件。

cp /cygdrive/c/Users/<username>/Desktop/file /tmp/file

How can I make Cygwin get my or the username of the person who is currently running it? 如何使Cygwin获取我或当前运行它的人的用户名?

I found it in a different answer, The profile of the current user is $USERPROFILE. 我在另一个答案中找到了它,当前用户的个人资料是$ USERPROFILE。

Putting them together it becomes: 将它们放在一起将变成:

cp $USERPROFILE/Desktop/file /tmp/file

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM