FTP error in powershell - powershell

I'm writing a fairly simply script and I'm trying to upload a file to an ftp server. I'm using the following command
ftp -n -s:upload.txt 292.78.51.12 (I've faked the IP)
It works perfectly in command prompt but it seems to have a problem with it in powershell.
I've tried giving the absolute path to upload.txt, put .\ before it and nothing seems to work.
Any idea what I'm doing wrong?

You need to put quotes around "-s:upload.txt". I believe it has something to do with the colon in the option. If anyone could clarify why that would be great.

Related

Download file to Windows PC from a remote Linux PC where the path to the file contains spaces

I have tried using both scp and sftp, in both Powershell and at the windows commandline. I also tried doing this from Windows 10 Linux Subsystem but nothing has worked so far.
Part of the problem seems to be escaping the remote Linux file path, which has a space in it. I can't use "\" as this is interpreted incorrectly by Windows. I have also tried using ^ and ` instead and using single and/or double quotes.
Using Windows cmd:
C:\Users\psnow>scp dad#192.168.1.4:"//home/naomi/Documents/School Work/Misc/schedule.pdf" c:\Users\psnow\Downloads\schedule.pdf
dad#192.168.1.4's password:
scp: //home/naomi/Documents/School: No such file or directory
scp: Work/Misc/schedule.pdf: No such file or directory
This one looked like it got past the space issue, but then came up with this weird error?
C:\Users\psnow>scp dad#192.168.1.4:"'//home/naomi/Documents/School Work/Misc/schedule.pdf'" c:\Users\psnow\Downloads\schedule.pdf
dad#192.168.1.4's password:
protocol error: filename does not match request
Using Linux Subsystem and Powershell both have similar responses.
All of the tutorials I've found on the subject use simplistic examples without spaces. I'd be happy to use sftp also, but I'm having similar issues with that too.
Have you tried escaping without quotes?
C:\Users\psnow>scp dad#192.168.1.4://home/naomi/Documents/School\ Work/Misc/schedule.pdf c:\Users\psnow\Downloads\schedule.pdf
Or, googling shows me that you have to escape with four backslashes inside ""
C:\Users\psnow>scp dad#192.168.1.4:"//home/naomi/Documents/School\\\\ Work/Misc/schedule.pdf" c:\Users\psnow\Downloads\schedule.pdf
Unfortunately I cannot try this right now.. hope one of them works for you
Update: Just tried and none of above worked for me
What worked for me:
C:\Users\psnow>scp dad#192.168.1.4:"//home/naomi/Documents/'School Work'/Misc/schedule.pdf" c:\Users\psnow\Downloads\schedule.pdf

'powershell.exeA' is not recognized as an internal or external command,

I am running into a bit of a problem when attempting to use Powershell with NRPE. Now I ran this command,
command[alias_check_commerce_log]=cmd /c echo C:\Program Files\nrpe\plugins\file_checker.ps1; exit($LastExitCode) | powershell.exe -command -
in cmd and it went through without a hitch. Just when I call it via Icinga, for some odd reason, it spits out 'powershell.exeA' is not recognized as an internal or external command. Now I know the A is not supposed to be sitting with powershell.exe, so how would I keep this from happening? Keep in mind that the command is the same in the config as posted here. Checked all text in hopes of it just being a simple Typo. I just can't seem to wrap my head around this one and figure out how to keep this from happening. Any and all help is appreciated, thank you.
Probably file encoding. You likely copy/pasted the command line from a web site or something, and there is a special character after .exe.
Open the file where that command is defined in an editor that supports different encodings and hopefully one that can show whitespace and "special" characters, and inspect the file.
Or Start over and manually type the commands.

Using the --glob_ignores flag of SVN_Load_Dirs.PL

I am attempting to use the SVN_Load_Dirs.PL script file (https://svn.apache.org/repos/asf/subversion/trunk/contrib/client-side/svn_load_dirs/) to attempt to merge a platform drop.
However, I can't get the --glob_ignores flag to behave as I'd expect, and I know so little perl that I can't dig into the script to understand why. The format I am using is:
--glob_ignores=*.jazzignore
Where I want to ignore all .jazzignore files (although I am fine with anything with "jazzignore" in either the extension or name being ignored. I've looked for examples but can't find any actual usage of this flag anywhere. What I am looking for is a way to ignore all .jazzignore files and a few entire directories (like jazz5 for an example)
I assumed the flag would then be --glob_ignores="*.jazzignore *.jazz5" but that doesn't appear to be working.
It turns out that the script was failing silently because I was running it from a windows cmd (and therefore never getting to the flag option). Apparently there are some issues running it this way and it was designed to be run from a linux command line. After switching it works perfectly.

Yii command tool not work

I use Yii command line inside web Root folder (C:\xampp\htdocs\myapps\cmd.exe). My command looks like this:
D:\xampp\htdocs\YiiRoot\framework\yiic shell
normally it will works, but now it didn't; I just get no output:
Sorry for late answer.
Have you configured access rules since last time you used it? If index.php isn't accessible without login anymore, the yiic tool will fail. You can overcome that by specifying the path to the config file:
protected\yiic shell protected\config\main.php
I experienced the same thing and in the end I discovered yiic file was unexpectedly empty!
A way to discover what happens behind the scenes is to comment "rem echo off" at the beginning of yiic.bat file.

XP command prompt : redirect a file to STDOUT

I want to do the opposite of everybody ( laugh )
I start open-erp with a command line like :
C:\OpenERPAllInOne\Server>openerp-server.exe --log-file=outputfile
but the problem is that with Windows it only does output to a file.
Is there any way to redirect a file to the STDOUT.
For example (it doesn't work but this is the way I see it working) :
C:\OpenERPAllInOne\Server>openerp-server.exe --log-file=STDOUT
and then see directly the output to the command line.
I can't make it work ! Any idea ?
Thanks,
Olivier
I'm not sure if it still works, try CON (hope it was that) as filename
That would be a function of the openerp-server.exe program.
If it's default output is to a file, then there isn't anything you can do about that.
I'm assuming that OpenERP uses getopt_long and confirms to GNU standards. If it does, then the following should work:
openerp-server --log-file=-
(a dash is usually used to represent STDOUT in GNU, Linux and UNIX programs.)
If you can't get the server to output to the standard output you could monitor the log file with [tail][1].
If you run:
tail -f c:\path\to\logfile.txt
in another window then you can see the contents of the file as they are written.
tail doesn't come with Windows as standard but you can download a free port of tail for Windows here.
for windows there is a configuration file for OpenERP Server,
like openerp-server.conf in the directory where you have installed the Open ERP
like c:\Program Files\OpenERP Server\openerp-server.conf OR
C:\documents and settings\USER\OpenERP Server\oepenrp-server.conf
you need to edit that file and set the --log-file paramter to None or False, and probably you might also try out something like this
C:\OpenERPAllInOne\Server>openerp-server.exe --log-file=False
that should work, but not sure whether it will work or not.!!