Copy file from FTP site to NFS share in Windows - ftp

We have setup a NFS share(//191.232.xx.xxx/export/share) in windows and mapped to Z:. Now we need copy a file from FTP server to Z:. When we try following it works
Z:\> (share NFS)
ftp server.com
ftp>get text.file
Above copies the file to Z:\text.file
But if I try try with UNC path, it don't work
ftp>get text.file //191.232.xx.xxx/export/share/text.file
I'm using windows native FTP and NFSCLIENT. The windows version is 2008 R2 sv1

You need to edit your registry and add an entry to disable the check on UNC paths.
HKEY_CURRENT_USER
\Software
\Microsoft
\Command Processor
Add "DisableUNCCheck" (This is a 'DWORD (32-bits) value').
Set it to hexadecimal value "1".
Now restart your environment and have another go, this should do the trick!

Related

Cannot create file \\server\printer

I have a module in vfp9 running under windows 7 32bits, this module prints in a local printer using the command COPY FILE file.txt TO \\server\printer, locally works fine, but in other pc of the network doesn't work, the error cannot create file \\server\printer shows.
In windows xp, this works fine, but in windows 7 not, I guess is a permission, wich one? where I can find information about this? I disabed the option "disable sharing with password protection" in advanced config of network and I can see all the shared resources, disks and printers.
I appreciate any help
That's a very 'legacy' way of printing and I wouldn't rely on it. If you have to do it this way, try redirecting an LPT port and then copying to the LPT port. At a CMD prompt:
net use lpt3 \\server\printer /yes
Then in your application
copy file file.txt to lpt3

How to run remote bat file without prompt

I have a remote drive mapped to my local Z:\ drive.
When running using this:
System.Diagnostics.Process.Start("Z:\\Test.bat");
It opens a prompt as to whether or not to open the file. How do I disable this setting in windows or get around it using c#?

How to download a file from my server using SSH (using PuTTY on Windows)

When I try downloading a file from my server onto my computer, it actually downloads the file onto the server.
(Note I am already SSH'd into my server before typing this command. I've watched tutorials on YouTube and people are using their terminal without SSHing into any particular server, however I don't think I can do this with PuTTY on Windows?)
scp -r -P2222 kwazy#mywebsite.example:/home2/kwazy/www/utrecht-connected.nl ~/Desktop/
The problem is that I am specifying the location to download the file as only ~/Desktop/
This creates a folder called Desktop in my server, instead of copying the files onto my local desktop.
I am able to use this command on Linux.
I have successfully download the folder onto my desktop:
I still need insight onto how I can do this on a Windows machine.
There's no way to initiate a file transfer back to/from local Windows from a SSH session opened in PuTTY window.
Though PuTTY supports connection-sharing.
While you still need to run a compatible file transfer client (pscp or psftp), no new login is required, it automatically (if enabled) makes use of an existing PuTTY session.
To enable the sharing see:
Sharing an SSH connection between PuTTY tools.
Even without connection-sharing, you can still use the psftp or pscp from Windows command line.
See How to use PSCP to copy file from Unix machine to Windows machine ...?
Note that the scp is OpenSSH program. It's primarily *nix program, but you can run it via Windows Subsystem for Linux or get a Windows build from Win32-OpenSSH (it is already built-in in the recent versions of Windows 10 and in Windows 11).
If you really want to download the files to a local desktop, you have to specify a target path as %USERPROFILE%\Desktop (what typically resolves to a path like C:\Users\username\Desktop).
Alternative way is to use WinSCP, a GUI SFTP/SCP client. While you browse the remote site, you can anytime open SSH terminal to the same site using Open in PuTTY command.
See Opening Session in PuTTY.
With an additional setup, you can even make PuTTY automatically navigate to the same directory you are browsing with WinSCP.
See Opening PuTTY in the same directory.
(I'm the author of WinSCP)
try this scp -r -P2222 kwazy#mywebsite.example:/home2/kwazy/www/utrecht-connected.nl /Desktop
Another easier option if you're going to be pulling files left and right is to just use an SFTP client like WinSCP. Then you're not typing out 100 characters every time you want to pull something, just drag and drop.
Just noticed /Desktop probably isn't where you're looking to download the file to. Should be something like C:\Users\you\Desktop
OpenSSH has been added to Windows as of autumn 2018, and is included in Windows 10 and Windows Server 2019.
So you can use it in command prompt or power shell like bellow.
C:\Users\Parsa>scp parsa#192.168.100.11:/etc/cassandra/cassandra.yaml F:\Temporary
parsa#192.168.100.11's password:
cassandra.yaml 100% 66KB 71.3KB/s 00:00
C:\Users\Parsa>
(I know this question is pretty old now but this can be helpful for newcomers to this question)
if you install git with git bash, you get SCP available on windows.
You can use WinSCP : https://winscp.net/eng/download.php
Or MobaXterm : https://mobaxterm.mobatek.net/download.html
It feels like FTP client. Also I don't remember setting up anything on my machine for this. It just fresh install and install SSH server (IDK if it matters though).
For MobaXterm :
If your server have a http service you can compress your directory and download the compressed file.
Compress:
tar -zcvf archive-name.tar.gz -C directory-name .
Download throught your browser:
http://the-server-ip/archive-name.tar.gz
If you don't have direct access to the server ip, do a ssh tunnel throught putty, and forward the 80 port in some local port, and you can download the file.
You can use the WinSPC program. Its access to any server is pretty easy. The program gives its guide too. I hope it's helpfull.
If you need something with GUI you can use FileZilla. it support SFTP.
It's perfectly working with ssh and you can even edit files and it will automatically upload the changes.

How to run bcp utility from root drive?

Machine does not have full sql server installed. but following distributable packages are installed on my machine:-
Microsoft® SQL Server® 2008 R2 Command Line Utilities
Microsoft® SQL Server® 2008 R2 Native Client
I have a batch file that runs bcp utility. If i run this batch file from the folder where bcp.exe is sitting (...tools\binn) it works.
but my dump question is if there is any way i can run this bcp utility from c:\ drive only. Right now if it run from c:\ drive it says:-
bcp is not recognized as an internal or external command,...
If you add the directory (...tools\binn) to your PATH variable or use the full path of the bcp executable this will work.
To add a directory to your PATH Control Panel > System > Advanced System Settings > Environment Variables.
Then find the Path Variable under system variables and add your bcp directory to the list (seperated by ;)
Just copy the bcp.exe from the other SQL Server or from respective SQL Server path
and copy it to batch file path, where you have your script.
While running the batch script, also please run from the same path in command line.

how to use xcopy to append to a file in remote machine?

I am using psexec to connect to remote windows machine and xcopy to copy few files and run the batch files present in remote machine. However the xcopy overwrites the contents of the file in the remote machine. How to use xcopy or something similar to append to files in the remote windows machine?
Or is it possible to copy a file from remote windows machine to local using xcopy or similar?
Note : the remote machine is windows and not running either ftp or any other service.
Thanks
Nohsib
Have a look at Robocopy - http://ss64.com/nt/robocopy.html
It is the Windows equivalent of Rsync.
You could try PowerShell 2.0 remoting. Should fit most of your needs.

Resources