Task Scheduler Error (0x1)? - batch-file

I created batch file with curl script for my Task Scheduler in windows. For some reason I'm keep getting error 0x1 after my script runs in scheduler. Here is my batch file script:
dir C:\curl.exe
for %%# in ("E:\One\Two\*.txt") do curl.exe -T "%%~f#" -u UserName:Password ftp://ftp.test.com/Hello/%%~nx#
If anyone can tell me what is wrong with my script or how I should create call in task scheduler.
Thanks in advance.

Related

How do I execute cmd commands through a bat file?

I need to create a .bat to put together with my setup system to install a network driver, but I have some difficulties in creating the bat.
This .bat needs:
execute a cmd with administrator privileges
run this command: netcfg.exe -v -l networkbll_lwf.inf -c s -i nt_networkbll
exit
The folder for all files location is: c:\Windows\System\Drivers.
You might have to use another batch file first to launch the second with admin rights.
In the first use
runas /noprofile /user:mymachine\administrator batchfilename.bat
PAUSE
and write the needed command in another bat file

batch file - sqlcmd failing in scheduled tasks (0x2331)

I'm trying to use scheduled tasks to run a database back up once per day using sqlcmd that points to a SQL script.
If I open a command prompt and run the code in the batch file everything is successful but when task manager tries it gets a 0x2331 error.
A search reveals it's something to do with permissions - maybe I need to change the path to the sql file?
here is the script:
ECHO OFF
ECHO This is running to backup a database
sqlcmd -S COMPNAME -i C:\backup.sql
GO
ECHO Success!
EXIT
I'm new to batch files to tried to keep it as simple as possble.

Batch - Echo to logfile works manually but not with task scheduler

I run this following script manually and it works. When script is running by task scheduler nothing happened. (Ignore date and time) Whats wrong?
echo Test %date% %time% > C:\Batch\run_backup_%date%.log
you need to make sure this file has proper file permission which will allow scheduler to execute..

Using SSIS execute process task to run a batch file

I was tasked to execute a batch file using SSIS "execute process task".
FYI,The batch file(named test.bat) uses PsExec command to call a runthisboy.bat file on a remote webserver to refresh the appPool. Here is what I wrote in the test.bat:
psexec -d -i -s \\webserver1 -u domainName\myID -p myPassword "C:\Documents\runthisboy.bat"
After I run the SSIS package, there is an error message shows up:
[Execute Process Task] Error: In Executing "C:\Windows\System32\cmd.exe" "/c C:\Users\myName\Desktop\test.bat" at "", The process exit code was "1" while the expected was "0".
But if I use this SSIS package to run other .bat file, like:
xcopy /d /y "C:\Users\myName\Desktop\sample.txt" "C:\documents"
It runs without any problems.
If anyone can give me some clue about what is happening here, I will be so thankful!

Encountering erros when trying to automate PSFTP command using a .bat file

In looking at other posts, "Batch file for PuTTY/PSFTP file transfer automation", regarding automating the PSFTP command in a .bat file so that I can setup a Windows Scheduled Task, I tried the following but got the error below:
In the .bat file that I'm executing I have the following lines:
#echo off
cd "c:\PuTTY"
psftp 999.99.999.999 -l XXXXXIO -i testGSX.ppk -b DownloadDiscoverReports.txt
In the DownloadDiscoverReports.txt file I have the following lines:
lcd c:\Reports\GSXDLFILES\ALLRPTS
cd /DSCVROUT/ALLRPTS/
mget *ALLRPTS%POLLABLE*
lcd c:\Reports\GSXDLFILES\XMIT81
cd /DSCVROUT/XMIT81/
mget *XMIT81%POLLABLE*
The error I'm getting when I execute the .bat file from my C:\ is:
C:\>gsx_dl.bat
psftp: no hostname specified; use "open host.name" to connect
New local directory is c:\Reports\GSXDLFILES\ALLRPTS
psftp: not connected to a host; use "open host.name"
C:\PuTTY>
Any suggestions/direction on how to fix this issue would be appreciated. Thank you.
This issue has been resolved. PuTTY support responded to my issue and I entered a -v switch to my command and found that my KEY had expired and that was the issue.
Thanks anyway.

Resources