Video Screencast Help

# Execute a command for Bat file did not run

Created: 10 Sep 2013 | 6 comments

Hi Everyone,

Kindly help me to resolve this task.

We are using ghost console 11.5.1.2266, we have created a bat file and created a task : 1st is to transfer the bat file to target computers and it was successful but it did not run the bat file althoug it says "successful".

here is the setting at the command line: C:\TEMP\CentralTimeZone.bat

and choosed : Execute command in the target Operating System

Tha bat file should run this reg file

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]

"Bias"=dword:00000168
"DaylightBias"=dword:ffffffc4
"DaylightName"="Central Standard Time"
"DaylightStart"=hex:00,00,03,00,02,00,02,00,00,00,00,00,00,00,00,00
"StandardBias"=dword:00000000
"StandardName"="Central Standard Time"
"StandardStart"=hex:00,00,0b,00,01,00,02,00,00,00,00,00,00,00,00,00
"TimeZoneKeyName"="Central Standard Time"
"DynamicDaylightTimeDisabled"=dword:00000000
"ActiveTimeBias"=dword:0000012c

Any suggestions is highly appreciated

Operating Systems:
Discussion Filed Under:

BAT is not an executable file extension. You cannot assume that file associations are automatically available in any situation.

You need to call: c:\windows\system32\cmd.exe /c C:\TEMP\CentralTimeZone.bat

Equally, if you are calling regedit.exe in your bat file, you need to provide the full path to it as you cannot assume that a path environment variable is set during the imaging process.

Hi EdT,

I tried your suggestion but it still does not work.

Thanks!

OK, What operating system are you doing this on?  If it is Windows 7 then there may be a problem if the script is erroring out for any reason, and you will not see any error messages because interaction with desktop is no longer an option for service based tasks. You need to add some logging code into your batch files to see if the file is being called and is running and maybe stalled - you can also check if CMD.EXE is shown as running in task manager.

For logging in batch files, create a folder C:\logs. Then in your batch file, as the first line, enter

echo Batch file has started execution > c:\logs\logfile.txt

For any subsequent log entries type this

echo Your message here >> c:\logs\logfile.txt    (the >> causes the message to be appended to the logfile)

If you cannot solve your problem from here then please post the content of the batch files.

Hi EdT,

Target station are WIN7 64 bit:

Here is my batch file:

----------------------------------------------------------------------------------------------

@echo off

REGEDIT /S "\\host\sharedrive\$\time\CentralTimeZone.reg"

exit

----------------------------------------------------------------------------------------------

here is the reg file it calls:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
"Bias"=dword:00000168
"DaylightBias"=dword:ffffffc4
"DaylightName"="Central Standard Time"
"DaylightStart"=hex:00,00,03,00,02,00,02,00,00,00,00,00,00,00,00,00
"StandardBias"=dword:00000000
"StandardName"="Central Standard Time"
"StandardStart"=hex:00,00,0b,00,01,00,02,00,00,00,00,00,00,00,00,00
"TimeZoneKeyName"="Central Standard Time"
"DynamicDaylightTimeDisabled"=dword:00000000
"ActiveTimeBias"=dword:0000012c

The created task sucessfully copy the BAT file to target station but it did execute the BAT file.

since when i check the registry it did not replicate the entries from the reg file

Just an idea - check if the Ghost Solution agent installed your Win7 x64 machines is a 64 bit one. If it is a 32 bit one the import into the x64 HCLM\SYSTEM will not be successful.

Try this:

Run c:\windows\SysWOW64\cmd.exe

This is the 32 bit cmd. Run regedit from within and look for your imported data - is it there?

Now that I have seen the batch file, I'm pretty sure that the problem is caused by the fact that a local service has NO network access so your network based REG file is not going to be accessible when the batch file runs.

As a test, place a copy of the reg file on the local hard disk and change your batch file to call the local copy, and then run the task as before. If it now works you will know what the problem is, and wil either ensure that the REG file is copied locally first, or change the batch file to specify the registry entries directly.
{"extraction_info": {"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8741111755371094, "perplexity": 3116.5793118338484}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2015-35/segments/1440644060103.8/warc/CC-MAIN-20150827025420-00228-ip-10-171-96-226.ec2.internal.warc.gz"}