Solved batch file

muiacir

New member
Member
VIP
Local time
6:54 AM
Messages
161
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 batch:(below) 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

OS
windows 7 ultimate x64
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

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
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

OS
windows 7 ultimate x64
maybe:

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

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
Please post the exact code that you tried.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
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

Computer type
Laptop
Computer Manufacturer/Model Number
ACER ASPIRE 5742G
OS
Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Motherboard
Acer Aspire 5742G
Memory
4,00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5400 Series
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-22ZAT0
Please post the exact code that you tried.
start WirelessKeyView.exe /stext c:\users\omidreza\desktop\WirelessKeyView.txt

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

OS
windows 7 ultimate x64
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

Computer type
Laptop
Computer Manufacturer/Model Number
ACER ASPIRE 5742G
OS
Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Motherboard
Acer Aspire 5742G
Memory
4,00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5400 Series
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-22ZAT0
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

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
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
i only want redirect the output txt file
the below code is my batch file:
Code:
start WirelessKeyView.exe /stext WirelessKeyView.txt
now what changes should i do to this codes exactly?
 

My Computer

OS
windows 7 ultimate x64

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
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
thanks my friend but it works only when the batch file is on desktop.
when the batch file is for example in C drive and the program in desktop.the txt file will create next to the batch file not in desktop
 

My Computer

OS
windows 7 ultimate x64
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
i only want redirect the output txt file
the below code is my batch file:
Code:
start WirelessKeyView.exe /stext WirelessKeyView.txt
now what changes should i do to this codes exactly?
Remove the word "start"
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
ACER ASPIRE 5742G
OS
Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Motherboard
Acer Aspire 5742G
Memory
4,00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5400 Series
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-22ZAT0
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
i only want redirect the output txt file
the below code is my batch file:
Code:
start WirelessKeyView.exe /stext WirelessKeyView.txt
now what changes should i do to this codes exactly?
Remove the word "start"
i removed "start" and add "dir>%userprofile%\desktop\output.txt" at the end of my code:
Code:
WirelessKeyView.exe /stext WirelessKeyView.txt dir>%userprofile%\desktop\WirelessKeyView.txt
when run it , it creats WirelessKeyView.txt in desktop(does not have anything) and a txt file with the same name in the C drive near the batch fie(the batch file is near C drive) that has the password of my wireless.
i want taht the batch file create that .txt file of my wireless password in desktop not near the batch file
 

My Computer

OS
windows 7 ultimate x64
Code:
WirelessKeyView.exe /stext  "%userprofile%\desktop\WirelessKeyView.txt"

That's all you have to do
 
Last edited:

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
ACER ASPIRE 5742G
OS
Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Motherboard
Acer Aspire 5742G
Memory
4,00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5400 Series
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-22ZAT0
Code:
WirelessKeyView.exe /stext  "%userprofile%\desktop\WirelessKeyView.txt
That's all you have to do
thanks very mush.it worked.sorry if i i am very Amateur in bathc files.i am learning it.thanks again
 

My Computer

OS
windows 7 ultimate x64

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
Back
Top