Good day! There are quite a few batch commands that are used to trigger events on three servers we have. I'm not really familiar with batch commands, but I have written a few. My problem is, I wrote a very simple batch command that calls and runs an .EXE file that automatically applies batches on a POS Server. Here is the command;
C:\grocery\sm2baply.exe /a
This has been working fine for weeks, but lately it just hangs until the next schedule task is ran with the same command and it overrides this. But the batches that should have been applied were not. About 3 out of 7 days it doesn't work.
Can someone help me please?
Thanks.
Schedule Tasks keep a log of what happened. So read the log.
In Scheduled Tasks select your task. History tab. EG one of mine failed with this.
- System
- Provider
[ Name] Microsoft-Windows-TaskScheduler
[ Guid] {de7b24ea-73c8-4a09-985d-5bdadcfa9017}
EventID 202
Version 0
Level 2
Task 202
Opcode 102
Keywords 0x8000000000000000
- TimeCreated
[ SystemTime] 2014-07-27T21:00:04.786Z
EventRecordID 2008255
- Correlation
[ ActivityID] {99694429-2673-4F4F-92E2-F55EDB9A20AC}
- Execution
[ ProcessID] 1700
[ ThreadID] 3140
Channel Microsoft-Windows-TaskScheduler/Operational
Computer Serenity
- Security
[ UserID] S-1-5-21-2820837959-2753176274-143444667-1000
- EventData
TaskName \Alarm2
TaskInstanceId {99694429-2673-4F4F-92E2-F55EDB9A20AC}
ActionName Hi
ResultCode 2147746317
2147746317 = 0x8004020d which is
//
// MessageId: EVENT_E_CANT_MODIFY_OR_DELETE_UNCONFIGURED_OBJECT
//
// MessageText:
//
// Cannot modify or delete an object that was not added using the COM+ Admin SDK
//
#define EVENT_E_CANT_MODIFY_OR_DELETE_UNCONFIGURED_OBJECT _HRESULT_TYPEDEF_(0x8004020DL)
If that doesn't work you need to monitor your batch. Echoing out things during execution (in case it's hanging). EG
Copy somefile.ext someotherfile.ext
echo Up to copy >> program.log
You can also start in a debugger.
windbg or ntsd (ntsd is a console program and maybe installed). Both are also from Debugging Tools For Windows.
Download and install Debugging Tools for Windows
http://msdn.microsoft.com/en-us/windows/hardware/hh852363
Install the Windows SDK but just choose the debugging tools.
Create a folder called Symbols in C:\
Start Windbg. File menu - Symbol File Path and enter
srv*C:\symbols*http://msdl.microsoft.com/download/symbols
then
windbg -o -g -G c:\windows\system32\cmd.exe /k batfile.bat
You can press F12 to stop it and kb will show the call stack (g continues the program). If there's errors it will also stop and show them.
Related
I've written a very simple batch file that bluescreens windows 7 (ultimate,enterprise,home) beyond normal repair, by making an attempt of loading a Win32 exe-file (the well known notepad.exe) into the operating system's kernel. Feel free to test it in a Virtual Machine, just open it as an administrator. Do NOT run this as administrator on your primary computer.
#echo off
sc create bluescreener binpath = C:/Windows/System32/notepad.exe type= filesys start= boot
sc start bluescreener
timeout /t 30
However: When I run this program on windows 10, it successfully creates the service, but it doesn't start. Instead it returns the following error:
[SC] StartService Failed 2: The system cannot find the file specified.
It is referring to the binpath I set in the batch file. I am sure this path exists, and that this is the exact path name. I don't understand why it can't find the file. I have tried using backslashes instead of forward-slashes, and that didn't work either. (I have forward-slashes because I have a python program that writes this batch file, and the line break in python uses a backslash, and that conflicts with the path.)
I tried the "sc qc bluescreener" test that shows information about the service I have created. This is what comes up. (It is the same thing that comes up when I test it on windows 7, where it works.)
[SC] QueryServiceConfig SUCCESS
SERVICE_NAME: bluescreener
TYPE : 2 FILE_SYSTEM_DRIVER
START_TYPE : 0 BOOT_START
ERROR_CONTROL : 1 NORMAL
BINARY_PATH_NAME : \SystemRoot\System32\notepad.exe
LOAD_ORDER_GROUP :
TAG : 0
DISPLAY_NAME : bluescreener
DEPENDENCIES :
SERVICE_START_NAME :
I can't find any explanation for why it can't find the file.
When I try to reboot windows 10 after creating the service, it can't boot, which means that the service is probably working and that the file was located. I just want to know why Windows 7 can find the file and immediately bluescreens, while Windows 10 can't find the file and needs to be rebooted for the service to run.
Any suggestions on how I might reproduce the same effect i get on Windows 7, but on Windows 10?
I finally gave up after 120 hours of not finding a .NET or javascript/jquery plugin that can read and write to a COMPRESSED custom user frame (TXXX) in ID3v2 MP3 audio file.
UltraID3Lib: cannot read or write COMPRESSED Frames (last updated 2009, author Mitchell S. Honnert fell off face of the earth).
ID3Lib-sharp: cannot read or write COMPRESSED Frames (last updated 2012)
JavaScript-ID3-Reader: can return bytes but it's mostly the wrong bytes. Cannot write anything.
I cannot use the multitudes of Node.js or PHP scripts for my project so they are out of the question.
The only code I found that can read and write compress frames is Kid3.
http://sourceforge.net/projects/kid3/
However, it is written in C (I don't know that) and uses third party frameworks since it was not built in windows. The Command program required 13MB of support dlls, QMs, and whatevers.
I have no choice at his point but to try and use it's separate command program kid3-cli.exe
So here's my question:
Here is the way to read a TXXX frame using the program at the command prompt.
"71F3-15-FOO58A77" is the name of the TXXX frame and the "2" gets the text value it holds:
cd "C:\mp3folder"
select "test.mp3"
get "71F3-15-FOO58A77" "2"
export "clipboard" "CSV unquoted" "2"
QUESTION: HOW DO I use a Batch file to run these commands?
According to kid3 documents. It shows using -c as grouped commands. Windows cmd (or the program) on windows does know what -c is.
Example: I double click the batch file and it should:
start the program
sent the program (not cmd) the above 4 lines
each must be executed separately.
Sounds simple, but I can't get it to even execute one of the programs code after starting.
Any ideas? and and can someone write a ID3 tag program that can read and write COMPRESSED TXXX tags without using node.js, PHP or a server in Windows.
I will buy them a beer because I'm really a (cheap) designer by trade and a pert-time programmer only when I have too.
Here is a zip file of a COMPRESSED TXXX Frame in test.mp3 to test:
[http://robbiestewart.ca/test.zip][1]
Download Kid3 and use its windows GUI (kid3.exe) to view the custom user frame (TXXX).
Run the included kid3-cli.exe to do the same at the command prompt.
Try to do the same in a batch file.
According to the help file, you should be able to use the command
kid3-cli -c 'cd "C:\mp3folder"' -c 'select "test.mp3"' -c 'get "71F3-15-F0058A77" "2"' -c 'export "clipboard" "CSV unquoted" "2"'
I ran it on the file you provided and seven tabs followed by 0:00.00 were put on my clipboard, but the value of the TXXX field indicated by the GUI was output to my command prompt.
I was looking for either a batch file, powerscript (not really good with yet)or any way to have my event logs exported to txt or csv on every start up?
Im using windows 7 pro if that helps
This will output last 20 system event logs in eventlog.txt.Not sure what exactly you need from eventlog - it's a big place...
WEVTUtil query-events System /count:20 /rd:true /format:text > eventlog.txt
You can change System to Application,Security or Setup - not sure what exactly you need.
more info:
http://ss64.com/nt/wevtutil.html
check also this:
http://ss64.com/nt/psloglist.html
You can save this (or similar) command to bat file and schedule it on start-up
WEVTUtil query-events System /count:20 /rd:true /format:text > exported_file_name.csv /q:"Event[System[(EventID=1074)]]"
Then gpedit.msc - windows settings - scripts and add to start up.
Thanks #npockmaka for getting this started
I'm pretty much a noob at this, so any help is appreciated.
I'm trying to run the video transcoding executable REDline on all .R3D files in a given folder. REDline only accepts single files, which is the issue. I finally got it to search recursively for the files I need, but my problem is the search function passes the next result to REDline before the first one is finished transcoding. I have the search results that need to run in a variable inside REDline.
Here's the code:
for /r D:\folder\ %%a in (*) do (
"C:/Program Files/REDCINE-X PRO 64-bit/REDLine.exe" --exportPreset "Prores_Intermediate" --i "%%~dpnxa" --useRSX 2 --masterRMDFolder "" -s 0 -e 95
)
After about .7 seconds, REDline reports 'received stop message from client'.
I don't think this is a REDline error, as I have been able to transcode single files successfully.
Thanks.
Try start /wait when running the executable.
If that does not help, the executable might start another executable which does the actual job. In that case identify the other executable using Process Monitor or Process Explorer. Check their command line parameter to see if you can run that executable directly.
If you can't run the other process yourself, you can wait until that process has exited. See Wait for executable to finish here on StackOverflow.
Im not familiar with that particular executable, but here are some suggestions you may try:
- Check the allowed parameters for REDLine.exe (documentation or possibly /?) to find out if there is any that might address your problem
- There are tools that allow you to check for the existance of a process (Microsoft Sysinternals, check the ones starting with PS*.exe) http://technet.microsoft.com/de-de/sysinternals/bb545021.aspx
Use this to improve your loop so that you check if the process is running first before continuing with the next loop - or loop without doing anything until the process has exited, you can do with repeatedly calling a ping to localhost inside your loop for a fixed time interval for example
- Check the errorcodes returned by programs to see if that helps you
- Put the code that starts your encoding inside its own batch file, and the check if the process is currently running as well
- Use the creation of a dummy file before starting and delete it once finished to discern if an instance of your batch is running
- Check the difference between calling a command directly from a batch file, and using the start command to run it at the same time
I am trying to get a couple scripts to work with each other, but I am not entirely familiar with the if-then commands, I am using wizapp and I have my info ready to go, but I don't know how to map a specific location based on the output of wizapp, as a for instance
if %siteid%=="0"
How do I map that to a drive, I have 10 different drives that have to be mapped using that
info, and I am lost, siteid will obviously be different in each if then statement?
This is relatively easy to do. I will provide manual instructions as it is extremely useful to learn and will improve your coding skills.
C:\windows\system32> net view
Server Name Remark
---------------------------------------------------------------------------------
\\PC1
\\PC2
\\PC3
\\PC4
\\PC5
\\PC6
\\PC7
\\PC8
\\PC9
\\SERVER
The command completed successfully.
C:\windows\system32> net view \\PC1
Shared resources at \\PC1
Share name Type Used as Comment
-------------------------------------------------------------------------------
SharedDocs Disk
The command completed successfully.
C:\windows\system32> net use ( Drive letter A-Z ) \\PC1\SharedDocs
The command completed successfully.
Now open up My Computer and youll see that PC1 is registered as a drive onto your computer.