如何将%userprofile%放入puppet exec中

时间:2018-06-15 10:27:49

标签: windows puppet

我需要将文件从临时文件夹移动到AppData文件夹,该文件夹位于%userprofile%文件夹下。

如果我试试这个:

exec { 'copy' :
 command => 'C:\\Windows\System32\cmd.exe /c "copy C:\tmp\file.txt %userprofile%\AppData\Roaming\"',
}

它会抛出错误。如果我把完整的路径放进去,它就可以了:

exec { 'copy' :
 command => 'C:\\Windows\System32\cmd.exe /c "copy C:\tmp\file.txt C:\\Users\usertest\AppData\Roaming\"',
}

但并非所有计算机都具有相同的用户名。

有没有办法做到这一点?

0 个答案:

没有答案