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

  • SEARCH
  • Home
  • 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 5938681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:43:13+00:00 2026-05-22T15:43:13+00:00

I am running a few commands on the domain computers. I would like to

  • 0

I am running a few commands on the domain computers. I would like to test it before I actually use it in the “bigger picture”. When I run this it returns data for the computers that it can connect to (no admin machine right now).

But for example if I list My personal Computer twice in the txt file it reads from, it says File is already being used and skips me.

Is this an error because its the same computer? I would like it to be able to just go ahead and write the duplicate if it comes across one.

Sub HandleInfo()
    'Declare Command
        Dim sCommand = "pushd \\*\C$ && whoami.exe >> C:\JavaInfo.txt && java.exe -version 2>> C:\JavaInfo.txt"
'declare File where Users are Located
        Dim strFile As String = "C:\TestDUsers.txt"
    'declare Lines in User.Txt File
        Dim strLines() As String = IO.File.ReadAllLines(strFile)
         For Each strUserName As String In strLines
        Dim ReplaceCommand As String = sCommand.Replace("*", strUserName)
        Shell("cmd.exe /c" & ReplaceCommand)
    Next
  • 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-05-22T15:43:14+00:00Added an answer on May 22, 2026 at 3:43 pm

    Change it to :

    Shell("cmd.exe /c" & ReplaceCommand, AppWinStyle.Hide, True, -1)
    

    This will make it wait until the command has finished executing. The -1 means it will not timeout, it’ll wait forever, so you can change that as you wish to suit.

    More info:

    http://msdn.microsoft.com/en-us/library/xe736fyk(v=vs.71).aspx?ppud=4

    Also, I’d change:

     Dim sCommand = "pushd \\*\C$ && whoami.exe >> C:\JavaInfo.txt && java.exe -version 2>> C:\JavaInfo.txt"
    

    To this, using double quotes, as cmd strings can be funny with spaces.

    Dim sCommand = """pushd \\*\C$ && whoami.exe >> C:\JavaInfo.txt && java.exe -version 2>> C:\JavaInfo.txt"""
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Python script that is running a few ls commands. This script
I would like to make a grid like network with few servers running Linux.
I'm writing some code which involves running a few shell commands from Python and
I am running this query which selects a few fields from one table and
I have a few work flows where I would like R to halt the
I've been having a few problems running PHP-based utilities within the command line ever
I'm playing around with get_iplayer (fantastic) it's running every few hours to grab any
few days ago i asked about how to get all running processes in the
Silverstripe is running on my since a few weeks. Recently, I get an Internal
We're going to running remote GUI on a few PCs, all communicating with a

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.