Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7889015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:59:13+00:00 2026-06-03T05:59:13+00:00

Currently working on a script to ping every host on a /24 subnet, and

  • 0

Currently working on a script to ping every host on a /24 subnet, and then executes another script which runs psexec on those machines which are online. The ping sweep script is called ping.bat and the other script which actually runs psexec on the machines is called deploy_mir.bat. I can simply run deploy_mir.bat on a remote host and it will run no problem.

The problem im having is that every time mir.bat runs, which itself contains a loop, it will display the help info for psexec in the cmd window. As far as i can tell everything is working fine, aside from the annoying fact that everytime the loop inside of mir.bat runs my cmd window gets filled with the help info for psexec. I dont have @echo enabled, not that it would cause this anyway.

hoping for a quick fix, but if my code is needed to get an answer ill post it.

Posting the code anyway…

@echo on

setlocal EnableDelayedExpansion

set /p ipAddress="enter ip address: "

for /l %%i in (1,1,255) do (
ping -n 1 %ipAddress%.%%i | find "TTL" > nul

if !errorlevel! == 0 (
call deploy_mir.bat %ipAddress%.%%i
)
)

endlocal

deploy_mir.bat code

@ECHO OFF

echo "Mir Agent deployment to: %1"


rem net use T: \\%1\C$ /user:administrator "password"
net use T: \\%1\C$ /user:administrator "username"

copy /y conf.xml T:\WINDOWS\
copy /y setup_mir.bat T:\WINDOWS\
net use t: /delete

rem psexec \\%1 -i -u administrator -p "password" c:\windows\setup_mir.bat
psexec \\%1 -i -u administrator -p "username" c:\windows\setup_mir.bat

Desired cmd line result of running deploy_mir.bat

C:\DOCUME~1\socuser2\MIR>deploy_mir.bat 10.180.145.66
"Mir Agent deployment to: 10.180.145.66"
The command completed successfully.

        1 file(s) copied.
        1 file(s) copied.
        1 file(s) copied.
t: was deleted successfully.


PsExec v1.94 - Execute processes remotely
Copyright (C) 2001-2008 Mark Russinovich
Sysinternals - www.sysinternals.com


c:\windows\setup_mir.bat exited on 10.180.145.66 with error code 0.

C:\DOCUME~1\socuser2\MIR>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T05:59:15+00:00Added an answer on June 3, 2026 at 5:59 am

    I don’t know why it works when called from outside the loop. But the psexec line in deploy_mir.bat should have cmd /c.

    psexec \\%1 -i -u administrator -p "username" cmd /c c:\windows\setup_mir.bat
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on a reminder PHP Script which will be called via Cronjob
I'm currently working on an AJAX file upload script, which works like a charm
I`m currently working on a script, and I have the following situation. function somnicefunction()
I'm currently working on a PowerShell script to analyse VPN traffic by reading the
I'm currently working on a jQuery script that will translate the site's text into
We currently have a working php mail script, this works fine and as we
I'm working currently on a long polling script where i've to check a database
Case Currently I'm working on database seeding script, executed with sqlcmd . For example
I am working on a AJAX/jquery notification script. Currently it retunrs a whole fhtml
I'm currently working a contract for a company which will be moving an access

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.