I have a Windows batch script (to be honest, it's a Groovy script). In this script I determine the root directory of a Cygwin installation. The next step is to find out the current user and home directory. In Cygwin this would be just a
echo $HOME
#=> /home/Christian
What comes pretty close to my problem is the following question: Get results of command from Cygwin in Batch. I would like to execute something like this:
"C:\cygwin[64]\bin\bash[64].exe" "echo $HOME"
However I receive a
#=> /usr/bin/bash[64]: echo $HOME: No such file or directory
This is because bash is expecting a script file and I want to execute a single command. How can this be done? Is there a possibility without putting the command in a script file?
My goal is to get the Windows path to the current users home directory so that I can iterate over this directory from a Windows script.