Mounting network drive works in DOS, but breaks in Cygwin. Why? - window

I'm using VirtualBox to set up a windows 2008 server. I'd like to add a shared folder, but am running into problems.
Running this in DOS works:
net use t: \\vboxsrv\v-root
But in Cygwin:
$ net use t: "\\vboxsrv\v-root"
System error 53 has occurred.
The network path was not found.
I've also tried these:
$ net use t: \\vboxsrv\v-root
$ net use t: \\\\vboxsrv\\v-root
And I've tried creating a bat script containing the working DOS command, and executing it from cygwin. They all fail with the same error.
I need to do it through Cygwin, because I access the system via SSH, and land in a Cygwin environment. If there is any way to "break out" of cygwin temporarily from within Cygwin, that might be a way to go..
What am I missing?

Create a folder somewhere, like:
$> mkdir -p /mnt/t
Now you can us the mount program in cygwin, like so:
$> mount \\vboxsrv\v-root /mnt/t
Easy as 1,2,3 :-)

The Windows root path is typically found somehwere under /cygdrive/. Try something like
$ net use t: /cygdrive/c/vboxsrv/v-root

For this error,
!) Give full rights to Shared folder at Host side using "sudo chmod 777 -R /home/username/Shared" (Shared is a folder name which we have to be shared.)
!!) Open Guest in Virtualbox, before accessing shared folder.: "Install Guest Additions" From Menu
!!!) Click START, Right click on Computer , Select "Map Network Drive"
!V) In that select any drive and bellow that type folder "\Yourhostipaddress\Shared". Bellow that select "connect with credential" (Yourhostipaddress is a HOST IP ADDRESS and Shared is Shared folder name at host side. )
V) Click On connect button. It will ask you host username and password.
Put **USERNAME** Properly like "**XXXXXXXX-PC**".
V!) It will map with shared drive successfully !!!!!!!!!!!!!!!!
If still getting error, Put comments bellow this.

Related

How to map a network share folder to a local folder in Windows without additional Apps

Lets say there is a shared folder: \\server\share\folder1 containing Folder2\file.ext
I would like mount that folder to c:\somePath\someFolder
So that I can reference c:\somePath\someFolder\Folder2\file.ext
Best I can find is mounting to drive letter. :(
The access to the file is just an example. Let's just assume there are a few servers and a few files. Powershell or cmd is fine. Heck I would take cygwin too. :)
TIA
In cmd (run as as administrator) run the following command:
mklink /D c:\somePath\someFolder \\server\share\folder1

Problems Installing PostgreSQL 9.2

I've been trying to install the 64bit version of PostgreSQL 9.2 for Windows on my machine (Windows 7 64bit) and get this error:
The environment variable COMPSPEC does not seem to point to the cmd.exe or there is a trailing semi colon present.
I've installed it as Administrator.
I disabled the antivirus (Microsoft Security Essentials) and the firewall.
Running:
"%COMSPEC%" /C "echo test ok"
returned test ok
I've checked my System Environment Variables for trailing semi colon and I couldn't find any.
I then installed the 32bit version and managed to get to the end of the install with a different error message stating: Problem running post-install step. Installation may not complete correctly Error reading the C:\Program Files (x86)\PostgreSQL\9.2\data\postgresql.conf but there is no postgresql.conf file in that directory. It did install the application and when I try to connect the server with the red X on it it says fail at the bottom and it won't connect after I type in my password.
How can I connect to this server connection?
ComSpec is a generic error message for any installation failure.
Identifying the problem
Navigate to below path
c:\Users\XXXXXX\AppData\Local\Temp
Open 'bitrock_installer_XXXX.log'
Check, if you are getting below error:
Script stderr:
'"C:\Users\XXXXX\AppData\Local\Temp\POSTGR~1\TEMP_C~1.BAT"' is not recognized as an internal or external command, operable program or batch file.
Error running
C:\Users\XXXXX\AppData\Local\Temp/postgresql_installer_47b21c4ea1/temp_check_comspec.bat :
'"C:\Users\XXXXX\AppData\Local\Temp\POSTGR~1\TEMP_C~1.BAT"' is not recognized as an internal or external command,
operable program or batch file.
This is a problem with '8.3 file names and directories' (e.g. '\Postgres Install' -> '\POSTGR~1')
Microsoft article on disabling 8.3 file names and directories: https://support.microsoft.com/en-gb/kb/121007
Solution:
Open command prompt in admin mode
Execute following command to change the format based on your drive or all drives
Sample commands:
fsutil 8dot3name set 1" - disable 8dot3 name creation on all volumes
fsutil 8dot3name set C: 1" - disable 8dot3 name creation on c:
Execute the installation as a user having admin privileges
After install, consider resetting the 8dot3name setting to default (2) to avoid unintended consequences
Hope it solves the problem!
Very easy fix:
Just open Advanced System Settings in Control Panel and create a new System Variable( in the System Variable instead of User Variable section).
In the variable name, enter ComSpec and then in the variable value , enter C:\Windows\system32\cmd.exe.
Alternative fix:
If you have already the ComSpec variable in the System Variable section, remove the ;at the end of it this should fix it.
It's not COMPSPEC it's just COMSPEC. Please show the output of:
echo %COMSPEC%
Note that COMSPEC could be set to something different in the Administrator account you're running the installer as. I'm not sure how to find that out, but it might appear in the PostgreSQL installer log, so please upload that and link to it in your post. See Reporting an installation error for info on where to get the installer log.
See the PostgreSQL for Windows FAQ entry Check the COMSPEC environment variable.
Here's a report I made suggesting that the installer should test for this explicitly and here's my blog post on the topic.
I got the same problem, and i found in the log:
Script stderr:
'C:\Users\S300' is not recognized as an internal or external command,
operable program or batch file.
Error running C:\Users\S300 (i5)\AppData\Local\Temp/postgresql_installer_56caeadbd6/temp_check_comspec.bat : 'C:\Users\S300' is not recognized as an internal or external command,
operable program or batch file.
I change in User Variables TEMP to D:\TEMP and TMP to D:\TEMP.
And Solved My Problem.
In my case , the Installer was in %USERPROFILE%\DownloadsP{ Windows download folder}, I moved the installer to desktop and ran again. weird it worked lol.
I had a similar problem. After installation, the data folder contained no postgres.conf file. It only contained a single folder named "pg_log".
I described the solution that I used here: Postgres Installation Error reading file postgresql.conf
Basically, it would be helpful to check if the user has full permissions for the postgres folder, and run "init_db" and "pg_ctl start" commands again. If the path contains a space character, try using a relative path for the pg_ctl data folder argument.
I'm running Windows Server 2003 R2, and I have been unable to resolve this problem with the installer, so I resorted to using the binary PostgreSQL package. Hopefully this will be an alternative for others who do not want to perform an OS reinstall.
First, some background (hopefully useful to the developers)
It started out with the postgres service failing to start (the server had been running reliably for over a year). I assumed it was a corrupted PostgreSQL installation, so I uninstalled and attempted to reinstall. I encountered the following error:
There has been an error.
The environment variable COMSPEC does not seem to point to the cmd.exe or there is a trailing semicolon present.
Please fix this variable and restart installation.
However, the COMSPEC variable is set properly, verified with:
echo %COMSPEC%
C:\WINDOWS\system32\cmd.exe
and:
"%COMSPEC%" /C "echo test ok"
test ok
Since this is Windows Server 2003, there is no UCA wrapper around the Administrator account, so that is not causing the problem.
Manual Installation
NET USER postgres /ADD
C:\pgsql\bin\initdb.exe -U postgres -A password -E utf8 -W -D C:\pgsql\data
runas /user:postgres "C:\pgsql\bin\pg_ctl -D C:/pgsql/data -l C:/pgsql/logfile.txt start"
just do it run as administrator and change the environment system variable
like create a new variable 'ComSpec' and value type 'C:\Windows\system32\cmd.exe'.
If the installer exe is on a network share that mapped drive might actually not be accessible to the installer as it runs as administrator. This can often happen in some virtual machine arrangements such as running windows in a parallels VM. Copy the installer to a local drive first and you won't have a problem.
What worked for me after trying to enter the commandline given her in cmd.exe
I found it was named cmd1.exe in system32.. so i copied the file and renamed it as cmd.exe and installation finished
Open Environment Variables, you can do this on Windows 7 by typing environment variables in the Search program and files bar when pressing the start button at the bottom left of the desktop. And create a new System Variable(in the 'System Variable' instead of 'User Variable' section).
In the variable name, enter ComSpec and then in the variable value , enter C:\Windows\system32\cmd.exe.
That's all. Hope it works!
Alternative fix:
If you already got the ComSpec variable in the System Variable section, remove the ; at the end of it this should fix it.
First find the path to cmd.exe(mostly it is C:\Windows\System32\cmd.exe).
Go to the enviornment variable and add this path to system variable path.And also create new variable in user variable called ComSpec and add this path as value. And you are ready to go.

Copy a non-shared file on a local network with a windows command

I'm using Windows 8.
How can I copy a non-shared file from another pc on my home network (another IP)?
This command can copy files, but only shared files:
copy \\{ip address}\Downloads\example C:\example_folder
copy (where and what) to (here)
I'd like something like this. But I don't know how can I copy a non-shared File? Is there a simple windows command I can run to do this?
You could try mapping a drive first and then doing the copy, then deleting the mapping. e.g.
net use x: \\computer name\share name
copy x:\Downloads\example C:\example_folder
....
net use x: /delete
where x: is the drive letter to map to locally.
If you don't have a share name, you could use the drive letter in the format of c$ for the c: drive on the remote machine or d$ for d: e.g.
net use x: \\computer name\c$
You will probably need to have a login for the remote machine. If you do, do the following.
net use x: \\computer-name\share-name password /user:username
I can't test this at the moment as I'm on my Linux machine, but give it a go as a guide.
See http://support.microsoft.com/kb/308582 for more details on mapping the drive

Git appears to have hijacked my windows command prompt

I installed Git for windows XP, and for some reason I couldn't get it to work. It threw and error code that showed it was looking for a network drive (drive Z:\ instead of the local drive C:). I got tired of fooling with it and decided to try the bash that came with GIT. Well, I got into the command prompt and saw the following:
Z:\[my name]>
I tried
Z:\[My name]>cd C:\
and all I got was a return back to the same prompt. It didn't actually switch directories. So, I tried
Z:\[My name]>cd D:\
which failed because the D drive does not exist. But, trying to switch to the C drive doesn't throw an error, it just doesn't do anything. I can't access my c drive via the command prompt any more at all.
A little bit confused, I uninstalled Git. Now, after rebooting, I still cannot access the C drive through the command prompt, and it defaults to the Z drive instead.
How do I fix this?
IIRC, try typing C:
(ie no command, just the drive letter to switch to)
Sounds like something stepped in and changed your home directory settings. Type echo %USERPROFILE% and you'll probably see your Z: drive set. Check your Environment Variables settings to change it back if you need.
Z:\[MyName]>PROMPT $p$g
Probably wrong but it is the solution to the literal interpretation of hijacked my prompt.

Is it possible to ssh into Windows (through a cygwin sshd) and start a program on a logged in Windows user's desktop?

Is it possible to ssh into Windows (through a cygwin sshd) and start a program on a logged in Windows user's desktop?
Put another way, say a user ABC is logged in on windows and a remote user logs in with ABC's login/password over ssh, can remote ABC pop up an app on the local ABC user's desktop?
I am asking this on Stackoverflow and not Serverfault because the motivation for doing this is programmatic in nature. The remote call will be coming from a Linux box so while it may be possible(?) to do this using WMI or some other approach, ssh seemed like the simplest.
Happy to hear simpler/better alternatives though.
Thanks!
If your cygwin sshd is running under a privileged account, it can get a handle to the current desktop and put windows on it. See the desktop parameter of STARTUPINFO for CreateProcess.
My own solution. Tested on windows XP (but I think it should run in any windows environment with a little effort).
You need to use the psexec and quser command.
First, put psexec and quser in a directory included in the cygwin's PATH environment variable. Just copy these files into the bin directory under cygwin.
You can find the quser.exe in your %system32%\dllcache dir. But for any reason I can't access to it (or access to the mentioned directory) through cygwin commands (i.e. ls, cp, etc), so I made a copy using the microsoft's copy command to the cygwin\bin folder.
Notes: I think it's helpful to have the suite psutils all in the bin folder of cygwin. The first time you run either of these utilities will have to accept a license agreement from Microsoft warning, so run psexec from Windows explorer the first time.
Then create these alias in your .bash_profile file:
alias winrun='psexec \\\\YOU_USERNAME_HERE -d -i `quser | grep YOU_USERNAME_HERE | grep console | awk "{print \\\$3}"`'
alias explorethis='winrun explorer $(cygpath -w `pwd`)'
Remember that you will need to translate the current directory using cygpath if you need to pass it as argument of a command ("explorethis" is an example of that).

Resources