Click here to Skip to main content
15,396,540 members
Home / Discussions / Windows Development
   

Windows Development

 
GeneralRe: Binding Pin
RedDk5-Mar-22 10:21
MemberRedDk5-Mar-22 10:21 
QuestionBatch file - If statement findstr Pin
User 1536543221-Oct-21 9:11
MemberUser 1536543221-Oct-21 9:11 
Hello, 

I've been working with this batch file for a few hours and I can't seem to get this file to work properly and I can't use PowerShell because my company's network won't allow it so I'm using a batch file.  I'm trying to go through a list of machines and I can't seem to get past the first machine.  I think I found the issue though but can't seem to get the line fixed to go to the second machine.  I think it's after the findstr line after troubleshooting the code line by line.

Here's my code of what I tried.


""
@echo off
For /f %%i in (C:\Users\%username%\desktop\computers.txt) do (
echo %DATE% %TIME%
echo.
Echo ************************
Echo %%i
Echo ************************
:name
ping %%i /n 1 | find "Reply from %%i:"
if errorlevel 0 echo The computer is online and on VPN
if errorlevel 1 echo The computer is offline or not on VPN
if errorlevel 1 goto skip
REG QUERY "\\%%i\regpath" | findstr "Computer"
query user /server:%%i
dir /T:W "\\%%i\C$\path\file.exe" | find "exe"
(findstr /i /l "configurationserver=https://URL" \\%%i\C$\path\file.ini > NUL && (goto skip) || goto fixfile)
:FIXFILE
echo pfile.ini isn't good
code to fix issue
:SKIP
echo file is good
)
pause
""

for testing purposes the computers.txt has two computer IP Addresses

%IPADDRESS%
%IPADDRESS%

I've tried errorlevel for the findstr and also the second solution within the code.

AnswerRe: Batch file - If statement findstr Pin
Dave Kreskowiak21-Oct-21 12:09
mveDave Kreskowiak21-Oct-21 12:09 
QuestionGetting the interactive user's display language from a service Pin
Daniel Pfeffer25-Aug-21 4:24
professionalDaniel Pfeffer25-Aug-21 4:24 
AnswerRe: Getting the interactive user's display language from a service Pin
Randor 25-Aug-21 10:08
professional Randor 25-Aug-21 10:08 
GeneralRe: Getting the interactive user's display language from a service Pin
Daniel Pfeffer25-Aug-21 10:56
professionalDaniel Pfeffer25-Aug-21 10:56 
GeneralRe: Getting the interactive user's display language from a service Pin
Randor 26-Aug-21 8:02
professional Randor 26-Aug-21 8:02 
GeneralRe: Getting the interactive user's display language from a service Pin
Daniel Pfeffer26-Aug-21 17:03
professionalDaniel Pfeffer26-Aug-21 17:03 
GeneralRe: Getting the interactive user's display language from a service Pin
Daniel Pfeffer31-Aug-21 10:03
professionalDaniel Pfeffer31-Aug-21 10:03 
GeneralRe: Getting the interactive user's display language from a service Pin
Randor 27-Sep-21 7:36
professional Randor 27-Sep-21 7:36 
GeneralRe: Getting the interactive user's display language from a service Pin
Daniel Pfeffer28-Sep-21 9:16
professionalDaniel Pfeffer28-Sep-21 9:16 
QuestionDisplaying a system modal message box in the system format Pin
Daniel Pfeffer4-Aug-21 1:49
professionalDaniel Pfeffer4-Aug-21 1:49 
AnswerRe: Displaying a system modal message box in the system format Pin
Richard MacCutchan4-Aug-21 3:12
mveRichard MacCutchan4-Aug-21 3:12 
GeneralRe: Displaying a system modal message box in the system format Pin
Daniel Pfeffer4-Aug-21 3:30
professionalDaniel Pfeffer4-Aug-21 3:30 
QuestionCheck if .exe-file, WITH A PATH(!!!), is running, from within a bat-file? Pin
arnold_w10-May-21 7:17
Memberarnold_w10-May-21 7:17 
AnswerRe: Check if .exe-file, WITH A PATH(!!!), is running, from within a bat-file? Pin
Victor Nijegorodov10-May-21 9:31
MemberVictor Nijegorodov10-May-21 9:31 
GeneralRe: Check if .exe-file, WITH A PATH(!!!), is running, from within a bat-file? Pin
arnold_w10-May-21 9:56
Memberarnold_w10-May-21 9:56 
AnswerRe: Check if .exe-file, WITH A PATH(!!!), is running, from within a bat-file? Pin
arnold_w11-May-21 22:35
Memberarnold_w11-May-21 22:35 
GeneralRe: Check if .exe-file, WITH A PATH(!!!), is running, from within a bat-file? Pin
Victor Nijegorodov11-May-21 22:47
MemberVictor Nijegorodov11-May-21 22:47 
GeneralRe: Check if .exe-file, WITH A PATH(!!!), is running, from within a bat-file? Pin
arnold_w11-May-21 23:18
Memberarnold_w11-May-21 23:18 
GeneralRe: Check if .exe-file, WITH A PATH(!!!), is running, from within a bat-file? Pin
Victor Nijegorodov11-May-21 23:49
MemberVictor Nijegorodov11-May-21 23:49 
GeneralRe: Check if .exe-file, WITH A PATH(!!!), is running, from within a bat-file? Pin
arnold_w12-May-21 0:38
Memberarnold_w12-May-21 0:38 
GeneralRe: Check if .exe-file, WITH A PATH(!!!), is running, from within a bat-file? Pin
Eddy Vluggen21-May-21 11:22
professionalEddy Vluggen21-May-21 11:22 
QuestionNeed Suggestions For Uninstalling Avast Secure Browser Pin
Gregorio Pollich19-Feb-21 2:51
MemberGregorio Pollich19-Feb-21 2:51 
QuestionGDI drawing Pin
David Crow7-Jan-21 10:24
MemberDavid Crow7-Jan-21 10:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.