In order to access a remote shared folder, I need to indicate the username and password. However, I have no idea where to put it in my WinSCP code.
open ftps://ftpuser:password#hostname/ -explicit -certificate="key"
cd Results
lcd \\networkname\sharedfolder\folder\
put *
This produces an error which is:
Error changing directory to '...'.
Any idea? Thanks
The error "Error changing directory", which you are getting is most probably caused by the lcd command. In Windows, the current working directory cannot be an UNC path (the \\networkname).
Instead of changing the current working directory, upload the file using a full path:
open ftps://ftpuser:password#hostname/ -explicit -certificate="key"
cd Results
put \\networkname\sharedfolder\folder\*
However if you actually need credentials for accessing the UNC path (the \\networkname), you have to authenticate prior to running the WinSCP script.
The batch file will be like:
net use \\networkname\sharedfolder password /user:domain\username /savecred /p:yes
winscp.com /script=... /log=...
net use \\networkname\sharedfolder /delete
Credits: How to create MAP Drive by batch file.
You still need to use the full path with the put command, instead of the lcd though. Unless you map the UNC path to a drive letter.
Related
This is a batch script activate.bat from the project w64devkit v1.3.1
#set PATH=%~dp0\bin;%PATH%
#busybox sh -l
I get error "The filename, directory name, or volume label syntax is incorrect" when i double click the batch script to run it but when i execute the batch script in the ConEmu terminal, it runs fine and drops me into a busybox shell.
I have read the question and best answer of this link and i still could not fix the error.
busybox.exe is in the bin directory and the activate.bat file is one directory above the bin folder.
All these files are in the w64devkit folder which was extracted from the zip file w64devkit.zip.
My operating system is Windows 8.1 Pro.
#NekoMusume comment worked.
The batch script worked when executed with administrator privileges.
Run the file as an administrator. Sometimes depending on security policies and group policies administrator access is required when changing environment variables.
I have a few applications that I am trying to deploy with SCCM 2012 but the installations are failing through the application catalog. So what I have for the deployment type is a script installer. I have "cmd.exe" (Without quotations) in the Installation program field and "Installer.bat" in the installation start in field.
When I look at the ccmcache folder, all the contents over that application are there but the following error displays the Software Center:
0x8007010B(-217024629)
I have done some reading online and the "10B" is a common command line error for invalid directory. I have tested the batch file when hard coding a path but my question is, how can I edit the batch file or SCCM to pull from the CCMCache path where the files are downloaded to on the local client? Currently the Batch File is simply:
#echo off
ApplicationName.exe
Do I need to edit the file to cd into the CCMCache folder where the files are placed? How can I get the batch file to run the executable that is downloaded to the CCMCache folder?
Thank You!
You need to have the full path to the installation in your script
#echo Off
\\path to .exe
The way the command is written will not be able to find the .exe file. You need to add the full unc path to the .exe into your .cmd file. You should have your installation .exe and .cmd file in the same location on the distribution share
Recommended Solution:
Before starting, since you are only launching an exe with your batch file, I would recommend just using your ApplicationName.exe as your command line parameter in SCCM instead of using a batch. This will eliminate the need to engineer any further.
Modifying the existing solution to work:
If you do still want to use a batch file, keep a few things in mind. The syntax you are using to launch the batch file will not work. I would recommend just using the batch file name "installer.bat" as your command line. If you still want to preface the batch with the cmd.exe, you absolutely need to use the /c switch with it
cmd.exe /c installer.bat
If you don't use /c the console host will only open to a promopt and not execute your batch.
This is not an ideal solution though because using "cmd.exe /c" will set your working directory to the location of cmd.exe (ie "C:\windows\system32") and since your content is staged in ccmcache, you will need to specify its location within your batch. To do this, you would use %~dp0 variable which gives you the directory the current batch is running from. This means modifying your batch to read
#echo off
%~dp0ApplicationName.exe
I try to copy a lot o file from my ftp = ftp://ftp.prodega.ch so:
I created a code.txt file with this text:
open ftp://ftp.prodega.ch
user
password
lcd /D "E:\f2\" //this is my local directory
cd Bilder1/ //this is ftp folder
mget *
pause
the I execute in cmd this row : ftp -s:code.txt but I meet with this error:
unknown host: ftp://ftp.prodega.ch
help me please
When connecting to a server via the built-in FTP client you have to skip ftp://!
So open ftp.prodega.ch will fix your issue.
However, you might still face another problem. The standard FTP client doesn't support passive mode which is required by most of the servers. If you are not able to modify the server, you won't be able to download the files. You should consider using a PowerShell script instead or use a different FTP client with command line support.
I know from a desktop I can have a bat file that runs an executable with specific parameters and starts in the same path on the network where the executable exists, but how can I accomplish the same thing when calling the bat file assuming is in same folder as executable from another application?
For example:
\My-Network\app\PR8.exe /noload
I want to start specifically in \My-Network\app (same folder where PR8.exe exists) but not where it defaults to which seems to be c:\windows somehow. I can't seem to do a cd on a UNC path and I don't want to use any path letters as the application also detects as to which server it is executing from as well.
It isn't possible to set a UNC working directory for Windows batch files without network mapping drives. However, in Windows 2000 and later, you can use the PUSHD and POPD commands to change the working directory to a UNC share when running your script.
Wikipedia gives us the example of creating a shortcut to your batch file where the Target is set to the following:
%COMSPEC% /E:ON /C "PUSHD """\\My-Network\app\""" & C:\PATH\TO\BATCHFILE.BAT & POPD"
In this case the Working directory attribute of the shortcut is ignored, as the PUSHD and POPD commands will change it to the path specified.
I'm trying to see samples of BlazeDs in my web brower as shown in the tutorial on this webpage.
After I have started tomcat i open the localhost link 8400/samples in my browser as shown below.After entering the url i get the following page in my browser..
After that i try to start the sample database according to the instructions given in a box at the starting of the webpage. After i run the specified command on my command prompt i get the following error message..
I can't seem to understand the error.Even though i have set the JAVA_HOME variable as follows still i am getting this error..
Is this error due to firewall problem? or something else??
Please Help..
java is not an internal command of cmd.exe.
As this command is without file extension and without full path, Windows searches first in current directory C:\blazeds\sampledb for java.* to find either java.com, java.exe, java.bat, java.cmd and some other file extensions.
The file extensions are defined in environment variable PATHEXT separated by semicolons which can be viewed in a command prompt window with command set PATHEXT
If there is no such file with file name java in current directory, Windows searches in all directories specified separated by semicolons in environment variable PATH. Entering just path or set path in a command prompt window results in a display of those directories. (set path lists the directories of PATH and the file extensions of PATHEXT as both environment variables start with the string "path".)
The environment variable JAVA_HOME is needed perhaps by the Java package itself and other applications, but is definitely not read by Windows to find an executable file with name java.
Search for the directory containing java.exe and append the directory of this file to PATH. On command line this can be done with:
PATH=%PATH%;Full path to directory containing java
Do not enter double quotes even if the full path to directory containing java.exe contains 1 or more space characters.
Or you run the java application with the command line
"Full path to directory\java.exe" -cp hsqldb.jar org.hsqldb.Server