How to run a specified bat file at particular time ie.. scheduler - windows

I have been using the at command to schedule the task
ex: at 14:45 my.bat
and i am getting the o/p on the command prompt as
"JOB ID is added"
But this command is not getting fired on the time which i have scheduled..
Can anyone please help me.......

I suspect the issue is not that the BAT file is not executing at all, but rather either or both of i) individual commands within the BAT file are failing, or ii) the output isn't getting sent to the place you're looking for it. (Things get even weirder if anything in the batch file requests input, since a) by default batch files may not be able to interact with the "console" at all and b) the system is probably unattended anyway at the time the batch file executes.) If my suspicion is right, there is no one "fix-everything" but rather a whole bunch of small fixes ...and you have to hit every one of them.
Find out the needed password to actually login as 'admin' (rather than your usual user), open a DOS box, and try to run the batch file. There should be some sort of error message that you can see. Fix that problem. Then try again ...and fix the next problem. Keep correcting problems and trying again until finally everything works.

Related

Is there a way to prevent a bash script from running certain commands if the script has to be run again?

I have a bash script that works at the moment. It gets an image and JDK 8 from a link and then runs a installer for the JDK 8 to move on to setting up another piece of software.
As I was debugging the script, I kept finding myself having to delete directories and even the java installation because when I introduce a fix and rerun the script, I have to wait for everything to download again and I have to worry about duplicate files messing up my current logic -which can probably be improved, but I'll go to the StackExchange Code Review site later.
At the moment, I would like to know what approaches there are to prevent commands -like downloading the JDK and running the JDK installer script all over again and others- from running again.
What kind of general approaches are out there for cases such as these?
For the JDK download and running the installer, I did think of simply checking for the existing of java on the system and if there is then bash would not not to run those commands.
However, there are other commands I do not want run and I do want to simply check, for example, the existence of certain files to prevent wget-ing them all over again and moving them -causing duplicates. (Should I maybe suck it up and do that anyway as that might be best practice?)
I did also think of perhaps, at each successful command, outputting like a 1 to a text file and mapping each line in that text file to the commands run in the script (like using an if statement to see if that command had a 1 or not in the text file) and if it was a 0, then the script would know only to run that command and never the 1s.
That sounded clunky to me and I am pretty sure that is not a good approach.

ld.exe cannot open output file

i've used CodeBlocks for 8 months and now begins give me problems.
When I compile a file I happen to receive an error that is not given by the compilation itself, but from codeblock.
The error is:ld.exe cannot open output file Permission Denied.
Then I changed the folder thinking it was a problem with the fact that I do not have administrator access so I could not save in certain parts
Then I tried to rebuild and for a while it worked, and the error would not show up,
now she has returned as before because it keeps giving me the same error.Someone has already received this errorand he resolved?
Thanks :)
Your program is probably still running in background, or another process is using that file like anti-virus.
Check in task manager, if the program process is still running you get this message.

Other causes for VB6 trappable error Path/File access error (Error 75)?

Apart from those listed by microsoft here.
10 DBEngine.CompactDatabase Dbpath, DbTempPath, "", dbEncrypt
20 Kill Dbpath
30 Name DbTempPath As DbPath
The above code operates day in day out in a lot of installations but then extremely rarely line 30 fails and I get a call that the database is missing.
Today for the first time I saw it happen myself and the error that was thrown:
Path/File access error (Error 75)
However I don't think that any of the listed causes apply in this situation.
When this happened at an installation today and I renamed the temp file and ran the code again and the error occurred again.
(I think it just might have something to do with a hardware issue as making a copy of the file took a very long time.)
There's not really enough information here to say, but my guess would be that the problem is with your KILL statement not finishing before the NAME statement runs. Its never been clear to me, but it seems that the Windows NT File System has the option of implementing some file operations (especially for large files) asynchronously, so that the KILL may not be completed by NTFS, even though VB6 thinks that it is and has moved on to the NAME statement.
Probably the best thing would be to put some check after the KILL to make sure that the file is actually gone, before starting the rename with NAME.
I'm not sure why the problem occurs but you could add a workaround using a DoEvents call or writing a small procedure to wait for a second or three (or longer) to allow time for the disk to complete the deletion or Access to release the file.
A more advanced workaround would be to write a function to check if the file is available before calling the rename.

VBscript scheduled task error

I have a VBScript that does a number of tasks, including moving files from one place to another.
Lots of copy/move/create folder/delete folder/delete files like this
Set filesys = CreateObject("Scripting.FileSystemObject")
filesys.CopyFile "D:\Test Now\test.txt", "W:\test_2\test.txt"
I'm able to get the entire script to work when I run it manually by double clicking it and no errors come up. However, when I run it from scheduled task an error is shown "Path Not Found". I found this error by writing this error to a DB.
If
ON ERROR RESUME NEXT
is off the script is stuck in that error. With it set to on, the script would skip the operations not carry out its function.
I've quadruple checked the paths to make sure its right. Is there something I should be aware of when running scripts with scheduled tasks?
Are D:\ And W:\ local drives, or are they mapped network drives? If they're mapped, the user running the process might not have those drives available. Be sure you run the task as a privileged local account. It's also best to log in to that account and run the command manually. Once you verify that it works, then you can tighten up security if that's a concern.
This jumps to mind: enclose your paths in quotes ". One of the two has a space in it. And VBSscript certainly won't like that.
filesys.CopyFile "D:\Test Now\test.txt", "W:\test_2\test.txt"
Yup, just tested it, and that is indeed what was causing the error.
By the way, you may know this, but unless you want to enter a debugging nightmare, you shouldn't use On Error Resume Next unless you have a very specific reason to do so .
An old topic I know, but this may help someone:
My scheduled task was running under a specific user. Using the component services snap in for MMC I needed to give the user 'Launch and activation' permissions. Once this was done, the scheduled task ran correctly.

How do I schedule for all the files of one folder to be moved to another server?

I did a quick search and couldn't see anything that was relevant which I found strange as this seems like it'd be a common question. Maybe I'm just going the wrong way about it or being thick? Who knows.
Anyway, I am trying to set up a scheduled task that moves all the files in a folder from Server A to a folder in Server B. If this was a simple matter of copying them it would be fine as I'd already got that working using Core FTP and a batch file but I'd like them to be removed from Server A after the copy has taken place.
I was looking at the windows ftp commands but although I managed to log onto Server A successfully from Server B whenever I tried to do a command it just took a very long time and then disconnected.
Any help in this would be appreciated, I need it to be a schedule-able file but it doesn't matter whether it is a .bat, .vbs or anything else that I haven't though of?
Thanks,
Harry
You could use www.Dropbox.com
Why? For stability. Any home-brew ftp script that moves files, is prone to an undetected error in transmission, resulting in deleted files.

Resources