PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
why wont this shelled "ping" create the output file ? [RESOLVED]-VBForums
Results 1 to 10 of 10

Thread: why wont this shelled "ping" create the output file ? [RESOLVED]

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Location
    TZI Transition Date
    Posts
    272

    Resolved why wont this shelled "ping" create the output file ? [RESOLVED]

    this works as expected...
    Shell ("ping 10.99.99.2"), vbNormalFocus

    this will not create the file ZZZtest.txt...
    Shell ("ping 10.99.99.2 > C:\ZZZtest.txt"), vbNormalFocus

    BUT...it will create it if shelled as a batchfile... ???????????
    Last edited by MJBNET; Jan 31st, 2005 at 04:55 PM. Reason: RESOLVED

  2. #2
    Super Moderator RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,664

    Re: why wont this shelled "ping" create the output file ?

    Use the double cheveron as the output designator.
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Command1_Click()
    4.     Shell ("C:\Windows\System32\CMD.exe /k ping 10.99.99.2 >> C:\ZZZtest.txt"), vbNormalFocus
    5. End Sub
    HTH
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2019, VS 2019

  3. #3
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: why wont this shelled "ping" create the output file ?

    Fascinating!

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Location
    TZI Transition Date
    Posts
    272

    Resolved Re: why wont this shelled "ping" create the output file ? [RESOLVED]

    tkx RobDog .... that was it...
    Last edited by MJBNET; Jan 31st, 2005 at 04:53 PM. Reason: [RESOLVED]

  5. #5
    Lively Member vbgamer45's Avatar
    Join Date
    Sep 2004
    Posts
    67

    Re: why wont this shelled "ping" create the output file ?

    Wow RobDog888 wished I would have known that a while back would have a saved be a lot of time. Bah there needs to be a manual for all these hidden tricks.
    Semi VB Decompiler 0.07 Getting better everyday
    http://www.visualbasiczone.com/produ...ivbdecompiler/
    VisualBasicZone
    http://www.visualbasiczone.com
    EasyPHPBB.com
    Free PHPBB forums the quick and easy way!

  6. #6
    Super Moderator RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,664

    Re: why wont this shelled "ping" create the output file ?

    Actually the trick was to actually use the command window's exe (CMD.exe)
    in the system32 directory. I dont know why two cheverons dont generate an
    error but it still seems to work just fine. For the /k that means to keep the
    command window open. /C means to Close the window after its done
    processing. You can do a CMD.exe /? at the command prompt for other
    switches.

    Ps, dont forget to Resolve this thread and if you feel its worthy you can give
    out Rep points either way (=/-) to any of the posts in this thread
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2019, VS 2019

  7. #7
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: why wont this shelled "ping" create the output file ? [RESOLVED]

    i had the system path and the cmd, but it wouldn't work with the single chevron. I was amazed when two worked. I seem to remember doing it some time before, but think that was a batch file. i even tried shellexecute!

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Location
    TZI Transition Date
    Posts
    272

    Re: why wont this shelled "ping" create the output file ? [RESOLVED]

    was wondering about what part that CMD bit played...good info !

  9. #9
    Super Moderator RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,664

    Re: why wont this shelled "ping" create the output file ? [RESOLVED]

    Just a side note: There is an API for getting the System32 directory on
    the machine so you can avoid hard coding the CMD path. I was just doing it
    for simplicity sake. The API is GetSystemDirectory.

    VB Code:
    1. Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" _
    2. (ByVal lpBuffer As String, ByVal nSize As Long) As Long
    3. Private Sub Form_Load()
    4.     'KPD-Team 1998
    5.     'URL: [url]http://www.allapi.net/[/url]
    6.     'E-Mail: [email]KPDTeam@Allapi.net[/email]
    7.     Dim sSave As String, Ret As Long
    8.     'Create a buffer
    9.     sSave = Space(255)
    10.     'Get the system directory
    11.     Ret = GetSystemDirectory(sSave, 255)
    12.     'Remove all unnecessary chr$(0)'s
    13.     sSave = Left$(sSave, Ret)
    14.     'Show the windows directory
    15.     MsgBox "Windows System directory: " + sSave
    16. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2019, VS 2019

  10. #10
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: why wont this shelled "ping" create the output file ? [RESOLVED]

    FYI,

    Here is source for creating your own Ping application

    Ping


    ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width