Ftp Windows Command Line Command Not Working - windows

I'm using Windows command line for getting some files from a ftp server.
I need to change the local directory during the session.
I tried using 'lcd' command but it's not working. I displayed that the command is executed correctly but when i download the files they are downloaded on another directory (default?).
Retyping 'lcd' to show the actual local directory i can see it does not change.
The code i used is written below
lcd C:\Myfolder\MySubFolder
I tryed also the cmd with administrative priviledges, but it is the same.
Thank You.

Related

Running a batch file through command prompt - system cannot find the path specified

I am trying to uninstall Oracle on this Windows 7 (64 bit) machine by downloading a standalone tool from Oracle, I need to run a batch file that is supposed to uninstall but I am unable to run it.
I tried to open command prompt as administrator and I am trying to run this as below:
As you can clearly see from the screenshot, I am doing a "dir" on the directory and can clearly see the file right there. Not sure what's going on here.
I also tried to run the batch file by double clicking from Windows Explorer and a terminal window opens and closes quickly but the batch file is not doing what it is supposed to do (it is clearly not executing from Windows Explorer).
Can anyone help me with this?
As theB pointed out above in a comment, this worked for me:
Open the bat file in notepad. I'll bet it starts with #echo off, and
that the error is actually coming from inside the batch file. The
error if the batch file itself wasn't found is 'X' is not recognized
as an internal or external command, operable program or batch file
'Run as Administrator' changes the current directory. See my answer here
Difference between "%~dp0" and ".\"?

WinSCP script file works in Windows 10 but not in Windows 7

I want to automate really simple ftp transfers with WinSCP (Example script file shown below. The real file would handle many files, but all simple stuff.)
open ftp://username:password#ftp.site.com/
option confirm off
cd remotedirectory
get file.csv
close
exit
A batch file containing:
winscp.com /script="staging get.txt"
opens a command prompt window and executes correctly in Windows 10, but in Windows 7 the command window opens and then immediately closes, and no files are transferred. WinSCP is in the path in both environments. I assume that a parameter or command is missing from one or the other file, but I don't know what it would be.
I was making a couple of small syntax errors. I couldn't see them because the command prompt window closed almost immediately, but the log file showed me what was happening and it was easy to fix. The lesson is - always create a log file.

Batch file - Remote Copy and Execute issue

I have a batch file that part of it copies a folder and its content to a local directory and then continues through the batch process which then tries to execute the contents of the folder . locally run it works on all wintel os and copies the files from \networkshare\folder*.* to %systemdrive%\temp\ .
I have attempted to use e.g psexec #serverlist.txt -c batfile.bat -s -f -d to copy the file and then execute it remotely how ever the issue is that this will not copy the files when run remotely . I think its a authentication issues after you a have remotely executed the batch file the remote system will not allow me to access/authenticate the networkshare
i have tried xcopy , copy , robocopy .
AFAIK you can only authenticate against the next hop using implicit credentials. Connection attempts from the first hop to a second hop will fail, even if your user has the required permisssions. See e.g. here for an explanation.
Try this:
psexec #serverlist.txt -u %USERDOMAIN%\%USERNAME% -d -c batfile.bat
Use explicit credentials so you're authenticated against the remote host. With that the second hop will be the next hop for your authenticated session. Don't run the script as LOCAL SYSTEM (-s), because that account is restricted to local resources.
I've had this issue in the past. Instead of trying to copy/run the BAT file just run the script things from a UNC path if you are able to. I think the problem lies in the BAT file not actually able to run through PSEXEC and copy like you think. Does it give an exit code?
Here's an example I used a while ago to install Adobe reader. I tried to do it through a batch file but no dice. I could not get it to run within the batch file whether I copied it or not. I can't remember the exact reason, I think it had something with the way a batch file is called in the system and runs in some sort of local context. Don't quote me on that though as I can't remember the exact why.
Here is my code example:
psexec /accepteula \\%computer% -s cmd /c msiexec /i "\\UNC\Software\adobe\Adobe Reader 7.0.9.msi" TRANSFORMS="acrobat7.mst" /qn

How to create and execute a file full of commands on Windows command prompt?

Example:
In Linux we can put the desired commands in a file and give it executable permissions. This helps us to actually run the file on the terminal and thus all the commands inside the file get automatically executed.
How to achieve this on Windows XP?
Same thing, but it's called a batch file, extension is .bat. You can also double-click to run these. This site is a great resource.

PuTTY run sh can't install fileinfo extension

I have a DreamHost server, and I would like to install the fileinfo extension.
I managed to create a custom php.ini file that's cool, but I'm totally stuck at this part in their documentation:
Please make sure to run 'dos2unix fileinfo_ext.sh' from the shell if you use a Windows-based editor to create this file.
So I am on Windows and running PuTTY and I have no clue about this part.
I copied fileinfo_ext.sh to my cgi-bin directory where my custom php.ini file is, but how do I go further? I'm totally lost how to run this command.
How can I do it?
"dos2unix" is a utility used to convert file from Windows line endings (CR+LF) to Unix line endings (LF).
So if you use Notepad to edit the file it will have Windows line endings. So dos2unix should be used on your computer (for that file) before sending it by FTP (or executing it on the host if you have ssh access and they have dos2unix).
But if you already use an editor which supports converting to Unix line endings, like UltraEdit or Notepad++ then all you need is to do a "convert to Unix" before saving the file.
You run the command as explained in the message. SSH to the server and login. Then cd to the location of the file, something like cd /path/to/your/site/cgi-bin and then run dos2unix fileinfo_ext.sh.
I hope this helps.

Resources