|
Hi
1) Yes, it is possible to pass arguments to a batch file. You use %number to get the argument by counting. For instance:
REM batch.bat
echo %1
echo %2
REM batch.bat
Now you call it "batch.bat Hello World" and the output is
Hello
World
If you have "echo off".
2) A better one =) I call the application from the prompt line, instead of just clicking it. This way, when it finishes, the window is still open and I can see the output.
regards
|
|
|
|
|
Below is the batch file I created. This batch file is used to run a command line exe which takes some parameters. Most of the time, it works with two parameters one for input file and the other for output file.
For example
C:\>myapp.exe input.txt output.txt.
I am just doing the execution using a below batch file.
REM xxx.bat
@echo OFF
%1
%2
%3
%4
myapp.exe %*
pause
But while executing batch file
xxx.bat input.txt output.txt
It opens the input.txt file and after closing the input.txt file it starts executing the myapp.exe with the given paramters.
I don know how to stop opening the input.txt, so that it will not open the input.txt and rather just executes the myapp.exe with the given parameters. Can you please help me to stop opening the input.txt file while executing the batch file.
Thanks,
Nandu
|
|
|
|
|
Sorry this question and just a general reply, in the above i forgotten to mark as question.
Below is the batch file I created. This batch file is used to run a command line exe which takes some parameters. Most of the time, it works with two parameters one for input file and the other for output file.
For example
C:\>myapp.exe input.txt output.txt.
I am just doing the execution using a below batch file.
REM xxx.bat
@echo OFF
%1
%2
%3
%4
myapp.exe %*
pause
But while executing batch file
xxx.bat input.txt output.txt
It opens the input.txt file and after closing the input.txt file it starts executing the myapp.exe with the given paramters.
I don know how to stop opening the input.txt, so that it will not open the input.txt and rather just executes the myapp.exe with the given parameters. Can you please help me to stop opening the input.txt file while executing the batch file.
Thanks,
Nandu
|
|
|
|
|
Thanks,
I got the solution, I have use ECHO as shown below.
Forum: Visual C++ / MFC
Subject: Re: About batch file
Sender: Nandu_77b
Date: Monday, July 7, 2008 1:14 AM
Sorry this question and just a general reply, in the above i forgotten to mark as question.
Below is the batch file I created. This batch file is used to run a command line exe which takes some parameters. Most of the time, it works with two parameters one for input file and the other for output file.
For example
C:\>myapp.exe input.txt output.txt.
I am just doing the execution using a below batch file.
REM xxx.bat
@echo OFF
ECHO %1
ECHO %2
ECHO %3
ECHO %4
myapp.exe %*
pause
-Nandu
|
|
|
|
|
It opens the file because of these lines:
%1
%2
%3
%4
You should write only:
REM xxx.bat
@echo OFF
myapp.exe %*
pause
If %1 is equal to "input.txt", them writing %1 just like that will open input.txt with the default application (usually notepad).
Hope i'v helped =)
Fratelli
|
|
|
|
|
Thanks a lot...it helped me very much.
- Nandu
|
|
|
|
|
hi
last week i attend one interview ,they asking one question in MFC .
i have one txt file which is contains.... numbers 1 2 3 4 5
my question is
how to sort in 3 digit form
like this:
123
134
145
234
245
251
345
351
312
451
412
423
512
523
534
i need this kind of output in xml file .
i need this kind of way ....i hav no idea abt how to get output..
thanks and regards
Nisha
|
|
|
|
|
You can use something like this:
#define next(i) ((i) < 5 ? (i) + 1 : 1)
#define previous(i) ((i) > 1 ? (i) - 1 : 5)
int main()
{
unsigned i, aux, j, cnt;
for (i=1 ; i<6 ; i++)
{
for (aux = next(i) ; aux != previous(i) ; aux = next(aux))
{
cout << i << aux << next(aux) << endl;
}
}
return 0;
}
The "next" macro increments a value until it reaches 5. When such happens, it returns to 1. The "previous" macro does the opposite, when the value reaches 1 it returns to 5.
regards
|
|
|
|
|
yes thanks ..but i want to this output into XML format...
|
|
|
|
|
In what format? You can always output the XML tags with the values... I just don't know for sure which tags you intend on using.
Regards
Fratelli
|
|
|
|
|
can anybody tell me how to set static IP address using c++ code using win32 API
|
|
|
|
|
you could try to have a look at the ip api... but most of it is pretty undocumented, so good luck 
|
|
|
|
|
sounds like a disaster in the making to me mate.
hard coding an IP address is going to fall over sooner or later depending on the network config.
i would ask if u really need to set a static IP addr or weather u can use a "localhost" type workaround
|
|
|
|
|
yes,my application requires so.could u pls help?my code is showing unhandled exception in this line
HRESULT hr = pSvc->GetObject(ClassName,0,NULL,&pClassObj,NULL);
|
|
|
|
|
|
HI all,
There is any class in MFC like PrintPreviewDialog.
Please tell me which class is use inplace of PrintPreviewDialog.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Print preview comes incorporated in most MFC doc/view apps if you choose it in the wizards.
You have to supply the correct drawing code of course.
|
|
|
|
|
In MFC,CPageSetupDialog for page setup and CPrintDialog for print dlg is available.
So i just want to know there is any class for PrintPreviewDialog.
I know that:
bob16972 wrote: Print preview comes incorporated in most MFC doc/view apps if you choose it in the wizards.
But i want to show it at a particular place, so i want to know about class which is related to printprevieewdlg.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
class CPreviewView : public CScrollView
one area where it is invoked is in CView::DoPrintPreview()
|
|
|
|
|
Hi dear,
I want to hide the cursor (for example: after 5 seconds) when the mouse doesn't move anymore.
(Windows Media Player does it when playing movie in the full-screen mode)
On the other words, how can I find when the mouse doesn't move?
Thanks.
|
|
|
|
|
|
If I have a method with two parameters, each with a default value, is there a way to set the value for parameter #2 while somehow still using the default value for parameter #1 when calling the method?
void SomeMethod(int nValue1=0,int nValue2=0);
|
|
|
|
|
bob16972 wrote: If I have a method with two parameters, each with a default value, is there a way to set the value for parameter #2 while somehow still using the default value for parameter #1 when calling the method?
void SomeMethod(int nValue1=0,int nValue2=0);
http://bytes.com/forum/thread62073.html[^]
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
I have a dialog. I set these properties:
System Menu = True
Maximize Box = True
Mimimize Box = True
The dialog just show a close button, but not show maximize button and minimize button.
I thoght that I miss some other properties? Can anyone tell me what's wrong here?
|
|
|
|
|
tataxin wrote: The dialog just show a close button, but not show maximize button and minimize button.
I thoght that I miss some other properties? Can anyone tell me what's wrong here?
These should be enough.
I face such problems mainly because my resource dll does not get compiled as dependency is not set on it, it is compiled on request only. So make sure the resource file is getting compiled.
Another possibility to check is whether these styles are being dynamically removed or not.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|