Clickable .BAT files?

Discussion in 'NZ Computing' started by Lawrence D'Oliveiro, Jan 14, 2010.

  1. A friend of mine is having an odd problem where his Windows XP machine seems
    to spontaneously connect to his dialup account.

    I’ve been trying to figure out an easy way he can execute the following
    command

    netstat -an >Desktop\netstat.dat

    and send me the resulting netstat.dat file. When I tried putting it into a
    file called “netstat.bat†on his desktop, and double-clicked it, all it
    seemed to do was open a window showing the command line, without actually
    executing it.

    Does Windows have the equivalent of .desktop files?
     
    Lawrence D'Oliveiro, Jan 14, 2010
    #1
    1. Advertising

  2. Lawrence D'Oliveiro

    Gordon Guest

    On 2010-01-14, Lawrence D'Oliveiro <_zealand> wrote:
    > A friend of mine is having an odd problem where his Windows XP machine seems
    > to spontaneously connect to his dialup account.
    >
    > I?ve been trying to figure out an easy way he can execute the following
    > command
    >
    > netstat -an >Desktop\netstat.dat
    >
    > and send me the resulting netstat.dat file. When I tried putting it into a
    > file called ?netstat.bat? on his desktop, and double-clicked it, all it
    > seemed to do was open a window showing the command line, without actually
    > executing it.
    >
    > Does Windows have the equivalent of .desktop files?


    Lawrence, I am having a problem. There is a fable about a shepherd who cried
    wolf.

    So check the permissions of the file, yes
     
    Gordon, Jan 14, 2010
    #2
    1. Advertising

  3. Lawrence D'Oliveiro

    Dave Taylor Guest

    Lawrence D'Oliveiro <_zealand> wrote in news:hiltea
    $8en$:

    > Does Windows have the equivalent of .desktop files?
    >


    No.
    Use the UNC path of the destination or the explicit path.
    ie. %HOMEPATH%/Desktop should work

    --
    Ciao, Dave
     
    Dave Taylor, Jan 14, 2010
    #3
  4. Lawrence D'Oliveiro

    Ted Guest

    On Jan 14, 2:53 pm, Lawrence D'Oliveiro <l...@geek-
    central.gen.new_zealand> wrote:
    > A friend of mine is having an odd problem where his Windows XP machine seems
    > to spontaneously connect to his dialup account.
    >
    > I’ve been trying to figure out an easy way he can execute the following
    > command
    >
    >     netstat -an >Desktop\netstat.dat
    >
    > and send me the resulting netstat.dat file. When I tried putting it into a
    > file called “netstat.bat” on his desktop, and double-clicked it, all it
    > seemed to do was open a window showing the command line, without actually
    > executing it.
    >
    > Does Windows have the equivalent of .desktop files?


    In Windows XP: I've just tried putting this command

    echo abcdef > test.txt

    into a file called test.bat on the desktop. Double-clicking it
    created a file called test.txt, on the desktop, with the expected
    contents.
     
    Ted, Jan 14, 2010
    #4
  5. Lawrence D'Oliveiro

    Ted Guest

    On Jan 14, 10:01 pm, Ted <> wrote:
    > On Jan 14, 2:53 pm, Lawrence D'Oliveiro <l...@geek-
    >
    > central.gen.new_zealand> wrote:
    > > A friend of mine is having an odd problem where his Windows XP machine seems
    > > to spontaneously connect to his dialup account.

    >
    > > I’ve been trying to figure out an easy way he can execute the following
    > > command

    >
    > >     netstat -an >Desktop\netstat.dat

    >
    > > and send me the resulting netstat.dat file. When I tried putting it into a
    > > file called “netstat.bat” on his desktop, and double-clicked it, all it
    > > seemed to do was open a window showing the command line, without actually
    > > executing it.

    >
    > > Does Windows have the equivalent of .desktop files?

    >
    > In Windows XP: I've just tried putting this command
    >
    > echo abcdef > test.txt
    >
    > into a file called test.bat on the desktop.  Double-clicking it
    > created a file called test.txt, on the desktop, with the expected
    > contents.


    But... doing the same with netstat -an > netstat.txt does just open a
    command window with the command displayed. However an extra "1" has
    crept in and it looks like this:

    netstat -an 1>netstat.txt

    I'm not sure whats going on here...
     
    Ted, Jan 14, 2010
    #5
  6. In message <6e4b431a-3cda-40b7-
    >, Ted wrote:

    > But... doing the same with netstat -an > netstat.txt does just open a
    > command window with the command displayed. However an extra "1" has
    > crept in and it looks like this:
    >
    > netstat -an 1>netstat.txt
    >
    > I'm not sure whats going on here...


    Exactly the same thing I saw.
     
    Lawrence D'Oliveiro, Jan 14, 2010
    #6
  7. Lawrence D'Oliveiro

    Enkidu Guest

    Lawrence D'Oliveiro wrote:
    > In message <6e4b431a-3cda-40b7-
    > >, Ted wrote:
    >
    >> But... doing the same with netstat -an > netstat.txt does just open a
    >> command window with the command displayed. However an extra "1" has
    >> crept in and it looks like this:
    >>
    >> netstat -an 1>netstat.txt
    >>
    >> I'm not sure whats going on here...

    >
    > Exactly the same thing I saw.
    >

    You could try a bat file containing :

    netstat -an &1>netstat.txt

    Cheers,

    Cliff

    --

    The Internet is interesting in that although the nicknames may change,
    the same old personalities show through.
     
    Enkidu, Jan 14, 2010
    #7
  8. Lawrence D'Oliveiro

    Ted Guest

    On Jan 15, 9:06 am, Enkidu <> wrote:
    > Lawrence D'Oliveiro wrote:
    > > In message <6e4b431a-3cda-40b7-
    > > >, Ted wrote:

    >
    > >> But... doing the same with netstat -an > netstat.txt does just open a
    > >> command window with the command displayed.  However an extra "1" has
    > >> crept in and it looks like this:

    >
    > >> netstat -an  1>netstat.txt

    >
    > >> I'm not sure whats going on here...

    >
    > > Exactly the same thing I saw.

    >
    >  >
    > You could try a bat file containing :
    >
    > netstat -an &1>netstat.txt
    >

    That doesn't create an output file at all. There is something odd
    about the netstat command. If you use another command, dir for
    example, then it works as expected. If you open a command line window
    and type in netstat -an>netstat.txt, then it also works as expected.
    But clicking on a batch file containing netstat -an>netstat.txt just
    copies the text of the command itself into the output file.
     
    Ted, Jan 14, 2010
    #8
  9. Lawrence D'Oliveiro

    Jeff Miller Guest

    I doubt that this will be very helpful,
    but you may be interested to know that
    it works perfectly on my machine.

    1. I created C:\test.bat with the single line:
    netstat -an > netstat.txt

    2. I moved test.bat onto the desktop.

    3. I double-clicked on its icon.

    4. The cmd window appeared very briefly,
    and then netstat.txt appeared on the desktop,
    with exactly the same contents as I got
    running netstat from the command line.

    A wild guess: it may have something to do
    with the Edit options for cmd.exe. I have
    Insert mode ticked, and
    QuickEdit mode NOT ticked.

    Good luck,
     
    Jeff Miller, Jan 14, 2010
    #9
  10. Ted <> wrote:

    > On Jan 15, 9:06 am, Enkidu <> wrote:
    >> Lawrence D'Oliveiro wrote:
    >>> In message <6e4b431a-3cda-40b7-
    >>> >, Ted wrote:

    >>
    >>>> But... doing the same with netstat -an > netstat.txt does just open a
    >>>> command window with the command displayed.  However an extra "1" has
    >>>> crept in and it looks like this:

    >>
    >>>> netstat -an  1>netstat.txt

    >>
    >>>> I'm not sure whats going on here...

    >>
    >>> Exactly the same thing I saw.

    >>
    >>  >
    >> You could try a bat file containing :
    >>
    >> netstat -an &1>netstat.txt
    >>

    > That doesn't create an output file at all. There is something odd
    > about the netstat command. If you use another command, dir for
    > example, then it works as expected. If you open a command line window
    > and type in netstat -an>netstat.txt, then it also works as expected.
    > But clicking on a batch file containing netstat -an>netstat.txt just
    > copies the text of the command itself into the output file.


    Try putting a space between the '-an' and the '>' so you have:
    'netstat -an >netstat.txt' ?

    --
    - Nicolaas
     
    Nicolaas Hawkins, Jan 15, 2010
    #10
  11. Lawrence D'Oliveiro

    Ted Guest

    On Jan 15, 12:48 pm, Jeff Miller <> wrote:
    > I doubt that this will be very helpful,
    > but you may be interested to know that
    > it works perfectly on my machine.
    >
    > 1. I created C:\test.bat with the single line:
    > netstat -an > netstat.txt
    >
    > 2. I moved test.bat onto the desktop.
    >
    > 3. I double-clicked on its icon.
    >
    > 4. The cmd window appeared very briefly,
    > and then netstat.txt appeared on the desktop,
    > with exactly the same contents as I got
    > running netstat from the command line.
    >
    > A wild guess: it may have something to do
    > with the Edit options for cmd.exe.  I have
    > Insert mode ticked,  and
    > QuickEdit mode NOT ticked.
    >
    > Good luck,


    The problem was caused by naming the batch file "netstat.bat". You
    can run batch files from within cmd.exe by just typing the file name,
    eg if you type "xyz" it will first look for "xyz.bat" in the current
    directory and execute that if it exists. So the netstat command would
    cause netstat.bat to be run again. You avoided that problem by naming
    your batch file "test.bat".

    So, Lawrence, use another name for your batch file.
     
    Ted, Jan 15, 2010
    #11
  12. In message
    <>, Ted
    wrote:

    > The problem was caused by naming the batch file "netstat.bat".


    Of course!

    Windows doesn’t have the standard shell protection of excluding the current
    directory from the search path for executables by default.

    But what a weird manifestation of the error, to actually change the command
    line that way...
     
    Lawrence D'Oliveiro, Jan 15, 2010
    #12
  13. By the way, in the process of trying to set this up, I discovered the “editâ€
    command, which opened a full-screen character-mode editor running within the
    terminal window.

    Useful, but when I exited it, all the components in the pathname in the
    command prompt had changed from long form to short form, i.e. “DESKTO~1â€
    instead of “Desktopâ€, that kind of thing.
     
    Lawrence D'Oliveiro, Jan 19, 2010
    #13
  14. Lawrence D'Oliveiro

    Ted Guest

    On Jan 19, 4:23 pm, Lawrence D'Oliveiro <l...@geek-
    central.gen.new_zealand> wrote:
    > By the way, in the process of trying to set this up, I discovered the “edit”
    > command, which opened a full-screen character-mode editor running within the
    > terminal window.
    >
    > Useful, but when I exited it, all the components in the pathname in the
    > command prompt had changed from long form to short form, i.e. “DESKTO~1”
    > instead of “Desktop”, that kind of thing.


    Try notepad instead.
     
    Ted, Jan 19, 2010
    #14
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Newbie4Ever

    Fixed & Tiny clickable images

    Newbie4Ever, Sep 26, 2005, in forum: Firefox
    Replies:
    2
    Views:
    482
    Ralph Fox
    Sep 26, 2005
  2. Guest

    URLs not clickable

    Guest, Nov 14, 2004, in forum: Computer Support
    Replies:
    3
    Views:
    4,547
    dadiOH
    Nov 15, 2004
  3. Rob Keel
    Replies:
    25
    Views:
    2,998
    Blinky the Shark
    Jun 26, 2005
  4. Penny
    Replies:
    3
    Views:
    1,485
    Randall Smith
    Aug 1, 2006
  5. Me
    Replies:
    4
    Views:
    917
    dadiOH
    Aug 29, 2006
Loading...

Share This Page