delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/02/23/10:20:48

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_THEBAT,KHOP_THREADED,SPF_SOFTFAIL,TW_YG
X-Spam-Check-By: sourceware.org
Date: Sat, 23 Feb 2013 19:05:23 +0400
From: Andrey Repin <anrdaemon AT freemail DOT ru>
Reply-To: Andrey Repin <cygwin AT cygwin DOT com>
Message-ID: <3849396.20130223190523@mtu-net.ru>
To: Thomas Deinhamer <thasmo AT gmail DOT com>, cygwin AT cygwin DOT com
Subject: Re: $USER is not resolved in paths sometimes
In-Reply-To: <kgac9l$2s4$1@ger.gmane.org>
References: <kg8pct$bnq$1 AT ger DOT gmane DOT org> <20130223092432 DOT 2564 AT binki> <kgac9l$2s4$1 AT ger DOT gmane DOT org>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Greetings, Thomas Deinhamer!

>> Thomas Deinhamer<thasmo AT gmail DOT com>  wrote:
>>> ....
>>> I'm new to Cygwin, new to this newsgroup too. ;)
>>>
>>> I'm running Cygwin and using the zsh shell.
>>>
>>> In the .zshrc file I got these lines:
>>> alias vboxmanage=VBoxManage
>>> vboxmanage setproperty machinefolder "C:\Users\$USER\VirtualBox VMs\"
>>>
>>> When I try to boot a VM using vagrant (which
>>> uses vboxmanage internally I think) sometimes
>>> $USER is not resolved to the real username.
>>>
>>> Instead vboxmanage creates a new machinefolder
>>> on C:/ which is then called "Users$USER" and
>>> inside this folder there is the folder "VirtualBox VMs",
>>> so the wrong path is "C:\Users$USER\VirtualBox VMs\".
>>>
>>> How could that be? Sometimes it works, sometimes it doesn't.
>>>
>>> Do I need to escape the backslashes or is
>>> there anything else I need to take care of?
>>>
>>> I'm wondering why it only fails sometimes.
>>>
>> I agree with Achim.  Don't use Microsoft Windows paths.
>> Cygwin has a function called cygpath which is very handy to use to convert paths and use in zsh and other shell scripts
>>
>> In zsh, using zsh syntax, I use it like this:
>>
>> Convert the first argument to a micrsoft window format pathname
>>     winpath=$(cygpath -w $1)
>>
>> or to convert a Windows formatted pathname to unix like do:
>>      fname=$(cygpath -w ${windows-type-ifname})
>>               
>> a hardcoded filename would be
>>      fname=$(cygpath -w ${C:\miscrosoft\windows-type-ifname.abc})
>>
>> * you may need to quote the flename to escape : or \....

> VirtualBox is installed via Windows,
> that's why I thought that the setting
> for "machinepath" needs to be a
> Windows-like path, no?

Path must be same as the environment it's used in.
In mixed environment, s.a. calling native windows programs from within cygwin
scripts, use -m option.

Also, please don't top-post.


--
WBR,
Andrey Repin (anrdaemon AT freemail DOT ru) 23.02.2013, <19:02>

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019