Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: undesirable .bat file side effects in Win7 pro 64-bit

21 Jun 2012   #11
Dwarf

Windows 8.1 Pro RTM x64
 
 

OK, here you go.

Code:
strDirectory = "c:\users\<UserName>\documents\pingresults\"
strFile = "pingresult.txt"
strIP = "173.194.67.94"
Const WriteMethod = 8
Set objFSO = CreateObject ("Scripting.FileSystemObject")
If objFSO.FolderExists (strDirectory) Then
Set objFolder = objFSO.GetFolder (strDirectory)
Else
Set objFolder = objFSO.CreateFolder (strDirectory)
End If
If objFSO.FileExists (strDirectory & strFile) Then
Set objFolder = objFSO.GetFolder (strDirectory)
Else
Set objFile = objFSO.CreateTextFile (strDirectory & strFile)
End If
Set objFolder = nothing
set objFile = nothing
Set objTextFile = objFSO.OpenTextFile (strDirectory & strFile, WriteMethod, True)
objTextFile.WriteLine (" ")
objTextFile.Close
Set objTextFile = objFSO.OpenTextFile (strDirectory & strFile, WriteMethod, True) 
wmiQuery = "Select * From Win32_PingStatus Where Address = '" & strIP & "'"
Set objWMIService = GetObject ("winmgmts://./root/cimv2")
Set objPing = objWMIService.ExecQuery (wmiQuery)
For Each objStatus in objPing
strPingResult ="True"
If IsNull (objStatus.Statuscode) Or objStatus.Statuscode <> 0 Then strPingResult = "False"
objTextFile.WriteLine (strIP)
objTextFile.WriteLine (strPingResult)
objTextFile.Close
Next
Adapt the initial variables to suit your needs. They should take the format shown.

strDirectory This is the directory where the results file is located.
strFile This is the name of the results file. Don't forget to include the .txt suffix.
strIP This is the IP address.


My System SpecsSystem Spec
.
22 Jun 2012   #12
threejeeps

win 7 64-bit
 
 

Cool Dwarf! Thank you! I got it to work...and thanks for the template that I can expand on.

So my last issue is writing a script to simulate a small mouse movement, i.e. 2-3 pixels, periodically.

I am aware of AutoIt and am looking into it. I am wondering if there is another approach?

-John
My System SpecsSystem Spec
22 Jun 2012   #13
UsernameIssues

W7 Pro SP1 64bit
 
 

Quote   Quote: Originally Posted by Ztruker View Post
Does you scheduled task launch a batch file? You don't show the action tab.
Not that you were talking to me... but:



Am I missing something in the OP's request?
My System SpecsSystem Spec
.

22 Jun 2012   #14
UsernameIssues

W7 Pro SP1 64bit
 
 

Quote   Quote: Originally Posted by threejeeps View Post
........Is there a way using a VB script to do a ping of a IP address and send the results into a file?.......
I'm not sure if you had the same requirement of hiding the command prompt window on this request too, but if the actions/settings shown in the video that I posted above do indeed hide the command prompt window for you then a simple batch file with

ping google.com > c:\users\username\foo\pingout.txt

or

ping 74.125.227.135 > c:\users\username\foo\pingout.txt

should do what you want

undesirable .bat file side effects in Win7 pro 64-bit-ping2file.jpg


My System SpecsSystem Spec
22 Jun 2012   #15
UsernameIssues

W7 Pro SP1 64bit
 
 

Quote   Quote: Originally Posted by threejeeps View Post
Cool Dwarf! Thank you! I got it to work...and thanks for the template that I can expand on.

So my last issue is writing a script to simulate a small mouse movement, i.e. 2-3 pixels, periodically.

I am aware of AutoIt and am looking into it. I am wondering if there is another approach?

-John
What is the end goal of this mouse movement? To prevent screensaver or power settings from kicking in?
My System SpecsSystem Spec
22 Jun 2012   #16
threejeeps

win 7 64-bit
 
 

Quote:
What is the end goal of this mouse movement? To prevent screensaver or power settings from kicking in?
Actually, it is to prevent having to reauthenticate. I understand the difference in what you point out,but not sure how (or if) either of them relate to logging in. I need to do some digging to better understand that.

-John
My System SpecsSystem Spec
22 Jun 2012   #17
UsernameIssues

W7 Pro SP1 64bit
 
 

If this mouse movement is to keep a VPN alive, then ping might be enough/better.

As far as moving the mouse - a scripting language like AutoHotKey or AutoIt will do. The AutoIt code in the attached text file (mm1.txt) does what you asked - but exiting that script is a bit problematic. The AutoIt code in (mm2.txt) is less likely to get a gamer banned while AFK.

See this post for some warnings/options about using AutoIt.


Attached Files
File Type: txt mm1.txt (333 Bytes, 5 views)
File Type: txt mm2.txt (113 Bytes, 5 views)
My System SpecsSystem Spec
29 Jun 2012   #18
Wrench11062

Windows 7Ultimate x64
 
 

Or you might just try removing:
@echo off

from the batch file.

Was told long ago when modems were used (tin-cans and strings like) in BBS
type batch files, @echo off removed the seen text on screen to stop some one
from seeing and Cntl-C ing the batch file.
My 2 cents FWIW..
My System SpecsSystem Spec
Reply

 undesirable .bat file side effects in Win7 pro 64-bit




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Side by side error stopping all 32bit apps and many window's fucctions
Hi all, I wounder if some can help me please I have an error message coming up on all 32bit application that says “the application has failed to start because its side-by-side configuration is incorrect.” I have done a lot of searching and found that most say I have to uninstall Visual C++ then...
General Discussion
Heavy Fire Afghanistan Side by Side Configuration error on install
I just recently re installed win 7 home. Now i am getting that error when trying to installing the game off the disk.
Gaming
Cannot run any exe file, side-by-side configuration incorrect
I have problem running any executable file, including opening zip files. I have uninstall Norton Internet Security came with the Lenovo laptop, and install Avast free antivirus, everything fine after installation. But today when I start the laptop, all executable files cannot start, such as IE,...
Software
Major side by side error on Win7 x64
Hi! I need help with big error. I'd try to install Adobe Premier Element, but i got error message "the application has failed to start because its side by side configuration is incorrect, please see application event log or use the command line sxstrace.exe tool for more detail" After that...
Software
Downloaded .wav file will not play in sound effects
I'm trying to change some of the various sound effect with downloaded portal .wav files. So have worked while others have not. The only difference I have seen between the one that have worked and the ones that don't is that the working one show a bit rate in their properties. Is there anyone that...
Sound & Audio
Missing Files but no side effects
Hi there: I installed and deleted lot of software etc, after a week, 20 minutes into booting these messages pop-up on the screen in form of square little boxes : Name Setup Name Setup Name Setup Name Setup...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 21:10.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App