|
-
Nov 20th, 2002, 09:24 PM
#1
Thread Starter
Lively Member
Excute a Dos FIle
I have a Win32 project and i want to execute an exe or BAT file from wihin the project
and I wnat the code for changing the directory from the c: to d: etc.
thanks
-
Nov 20th, 2002, 09:37 PM
#2
Q1 : You can use ShellExecute
Code:
ShellExecute(0,"OPEN","C:\\test.bat","","",SW_NORMAL);
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Nov 20th, 2002, 10:13 PM
#3
Thread Starter
Lively Member
this didn't work
I a using VC++ 6 and
my Project is WIn32 console Aplication Project (Dos type)
Code:
#include "stdafx.h"
main()
{
int x;
printf("\n");
printf("Please Make your choice\n");
printf("--------------------------\n");
printf("1- Run close-up 6.5\n\n");
printf("Or press Enter to Exit\n");
scanf("%d",&x);
if (x==1)
ShellExecute(0,"OPEN","d:\cls\crm","","",SW_NORMAL);
return 0;
}
-
Nov 20th, 2002, 10:15 PM
#4
Stuck in the 80s
You must include <windows.h>
-
Nov 20th, 2002, 10:16 PM
#5
Oh, its a console program. I just assumed you meant a windows app. Just add #include <windows.h> at the top.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Nov 20th, 2002, 10:20 PM
#6
Thread Starter
Lively Member
Still no Help
I don't wan to run this Applicaion from Windows
I want to make it run from dos .
I want to make it run from Autoexec.bat
-
Nov 20th, 2002, 10:33 PM
#7
Stuck in the 80s
I may be wrong, but I think you have to be in windows to use the windows resources. Unless it's packed in there during compilation. Not sure, though.
-
Nov 20th, 2002, 10:39 PM
#8
Thread Starter
Lively Member
my Project is WIn32 console Aplication Project (Dos type)
-
Nov 20th, 2002, 10:48 PM
#9
Stuck in the 80s
Originally posted by moja
my Project is WIn32 console Aplication Project (Dos type)
I think we've already established that...
-
Nov 20th, 2002, 10:52 PM
#10
Thread Starter
Lively Member
my friend
1- I tried to use include <windows.h> with no Help
2- I want o run my application just prior to windows staring (i.e. include it in Autoexec.bat )
so no requiremnt for windows resorces to be there.
am I right.
-
Nov 20th, 2002, 11:04 PM
#11
Good Ol' Platypus
If it's supposed to be outside of Windows... and you're trying to use Windows.h... does that make any sense? Anyway, it looks like you're trying to create a bootloader of sorts. Autoexec.bat is called after the default bootloader, I just thought I'd let you know. And, all that you are trying to do is easily accomplished WITH a batch file. I suggest you learn them inside out... man, it was fun tweaking BAT files back in the day...
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Nov 20th, 2002, 11:11 PM
#12
Stuck in the 80s
Originally posted by moja
my friend
1- I tried to use include <windows.h> with no Help
2- I want o run my application just prior to windows staring (i.e. include it in Autoexec.bat )
so no requiremnt for windows resorces to be there.
am I right.
I think the big thing you need to realize here is something you said yourself:
my Project is Win32 console Aplication Project (Dos type)
It is a Win32 Console Application. Not a DOS program.
-
Nov 21st, 2002, 07:05 AM
#13
Frenzied Member
Code:
#include <stdlib.h>
system("c:\\myfile.bat");
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|