开发者

Powershell: "set home=PATH"

开发者 https://www.devze.com 2023-02-27 03:35 出处:网络
i try to migrate a cmd Batch file to powershell, but powershell don\'t accept the SET HOME command. The Script

i try to migrate a cmd Batch file to powershell, but powershell don't accept the SET HOME command. The Script

SET HOME=c:\home\user
$destination=user@server:/cygdrive/c/Build
$source=/cygdrive/c/Build

rsync -av -e "./ssh" $source $destination
开发者_C百科

./ssh don't access to HOME, but the same Script run as cmd-Bash, any suggestion to set a Home Path like the cmd-bash SET HOME?

Regards Rene


$Env:HOME = 'C:\home\user'
$destination = 'user@server:/cygdrive/c/Build'
$source = '/cygdrive/c/Build'

rsync -av -e ./ssh $source $destination

What you have there is neither PowerShell nor a batch file, actually.


SET is an alias for Set-Variable, which you can't use to set enviroment variables like in cmd, but there are solutions to do what you want, e.g. here

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号