batch file

Page 1 of 2 12 LastLast

  1. Posts : 161
    windows 7 ultimate x64
       #1

    batch file


    hi guys.
    i have a question about bach files.
    i am learning.
    i want to create a bach file that when we run it , it runs a program and saves the programs data as txt file on a specific folder.
    i write this batchbelow) file but do not know what is the orders to save the txt file in a specific folder(my batch file save the files in the root of drive)
    Code:
    start program.exe /stext program.txt
      My Computer


  2. Posts : 10,485
    W7 Pro SP1 64bit
       #2

    This part of the batch file is called a switch:

    start program.exe /stext program.txt

    It will not work unless program.exe watches for that switch.

    What is the name of the program?
    And do you have a link where it can be downloaded?
      My Computer


  3. Posts : 161
    windows 7 ultimate x64
    Thread Starter
       #3

    i do not have the name of program.i am learning batch file.and do not test this order for a program yet.but as you said it is switch but it save the txt file in the root that the batch file is.for example if the batch file is in C drive.it creates txt file in C drive.i want to create txt file for example in a folder in desktop
      My Computer


  4. Posts : 10,485
    W7 Pro SP1 64bit
       #4

    maybe:

    start program.exe /stext c:\users\username\desktop\program.txt
      My Computer


  5. Posts : 161
    windows 7 ultimate x64
    Thread Starter
       #5

    i found a program to test.
    WirelessKeyView: Recover lost WEP/WPA key/password stored by Wireless Zero Configuration service
    i test your answer but it does not work.
      My Computer


  6. Posts : 10,485
    W7 Pro SP1 64bit
       #6

    Please post the exact code that you tried.
      My Computer


  7. Posts : 10,796
    Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
       #7

    Don't use "start"! And redirecting output to file instead of console is done by using >

    dir > %userprofile%\desktop\output.txt

    To output error messages and well:
    dir > %userprofile%\desktop\output.txt 2>&1

    To add output to some file
    dir >> %userprofile%\desktop\output.txt

    source: Microsoft Corporation
      My Computer


  8. Posts : 161
    windows 7 ultimate x64
    Thread Starter
       #8

    UsernameIssues said:
    Please post the exact code that you tried.
    start WirelessKeyView.exe /stext c:\users\omidreza\desktop\WirelessKeyView.txt

    Kaktussoft said:
    Don't use "start"! And redirecting output to file instead of console is done by using >

    dir > %userprofile%\desktop\output.txt

    To output error messages and well:
    dir > %userprofile%\desktop\output.txt 2>&1

    To add output to some file
    dir >> %userprofile%\desktop\output.txt

    source: Microsoft Corporation
    i did not understand what you said.can you please write the codes as a batch file for my example
      My Computer


  9. Posts : 10,796
    Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
       #9

    Do you want to redirect output or error messages or both? If both.... to same file?

    dir>%userprofile%\desktop\output.txt

    Put that in a bat file and run it. a file output.txt appears on desktop
      My Computer


  10. Posts : 10,485
    W7 Pro SP1 64bit
       #10

    muiacir said:
    UsernameIssues said:
    Please post the exact code that you tried.
    start WirelessKeyView.exe /stext c:\users\omidreza\desktop\WirelessKeyView.txt
    This application does not support a full path in front of the output file. If you want the txt file to be on your desktop, then move the file named WirelessKeyView.exe to your desktop and try this:

    c:\users\omidreza\desktop\WirelessKeyView.exe /stext WirelessKeyView.txt
      My Computer


 
Page 1 of 2 12 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 02:46.
Find Us