Even though I have been using Windows and Linux separately for quite some time now, I only very recently had the need to access a shared folder on a Windows machine from a Linux box using a command line. I came across loads of information and tools which are available for accessing shares among Linux and Windows.
And even though there might have been some helpful page which has it all listed out - I had to go through a little bit of trouble finding what I had to know and do to make it work, so I am listing them down for future reference and/or helping out if someone finds themselves in a similar position.
Since I had to access the shared folder using command line (being used in a tool which I am using telnet to servers and running command from the telnet prompt to access certain files from Windows/Linux machines) most of the easiest ways e.g. using Filezilla, FTP amongst others were out, so to compile the information I found helpful:
1. I have to mount shared windows folders on the linux machine to be able to access those shared files
2. To be able to mount folders, the Linux machine needs Samba running (there are many helpful sites which help in setting up Samba) and to quickly check if it is running or not, type : ps -ef | grep smb (there is actually no space between 'ef', '|' and 'grep' - only for formatting purposes).
If results with smbd -D show up, it means Samba is already installed and working (which was in my case)
another way to check it is going through the UI looking for "Connect to Server.." and actually trying to connect to the share - but only for confirmation since this method was out of bounds for me.
3. Create a folder where the shared folder will be mapped to in /mnt - at the end of the process all the shared folder contents show up in this folder.
4. Many helpful forums suggested using something like:
sudo mount -t nsf -o username=xxx,password=xxx //<IP/hostname>/<shared folder> /mnt/<mapped folder>
or without the '-t nsf' which is for the network shared file type, but unfortunately they didn't work, but
sudo mount -t cifs //<IP address/hostname>/<Shared folder name> /mnt/<created folder for mapping> -o username=xxx,password=xxx
worked for me (the share was on a Windows Server 2008 R2 machine)
Incase Windows to Windows shared map has to be created the best way I found to be was to use:
net use <free drive Letter>: \\<IP/hostname>\<shared folder> /user:<username> <password>
Clean up also should be performed, using umount and /delete with net use for the Linux and Windows respectively created mapped shared locations.