Discussion:
Nmake: Action shell command to change the directory?
(too old to reply)
Ravi
2008-01-23 05:40:22 UTC
Permalink
In the makefile, I want to have an action to change the directory. For
example:

changedir:
cd..



But when I run "nmake changedir" it prints out "cd.." to the Dos
Window, but it doesn't switch to the parent directory
-- it just remains in the same subdirectory.

Is it possible to do this?
Andy Sinclair
2008-01-23 08:43:51 UTC
Permalink
Post by Ravi
In the makefile, I want to have an action to change the directory. For
cd..
But when I run "nmake changedir" it prints out "cd.." to the Dos
Window, but it doesn't switch to the parent directory
-- it just remains in the same subdirectory.
Is it possible to do this?
The current directory is changing, but only in the makefile process.

For example, try running the following makefile:

changedir:
cd
cd ..
cd

The directory changes while the makefile is running, but the current
directory of the calling process is unaffected.

What are you trying to achieve?

Andy
Ravi
2008-01-24 04:50:43 UTC
Permalink
Post by Andy Sinclair
Post by Ravi
In the makefile, I want to have an action to change the directory. For
cd..
But when I run "nmake changedir" it prints out "cd.." to the Dos
Window, but it doesn't switch to the parent directory
-- it just remains in the same subdirectory.
Is it possible to do this?
The current directory is changing, but only in the makefile process.
cd
cd ..
cd
The directory changes while the makefile is running, but the current
directory of the calling process is unaffected.
What are you trying to achieve?
Andy
I need to cd into the directory that contains the obj files and run a
command.
Notice that nmake is placing the "dir" command on the same line as the
"cd" command.

It looks like it is a problem with long file name directory. It works
OK with a short name directory.

Example 1:

test:
cd .\Example_DHC_Application_3.0_Data\Debug\ObjectCode\
dir

C:\>nmake test

Microsoft (R) Program Maintenance Utility Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.

cd .\Example_DHC_Application_3.0_Data\Debug\ObjectCode dir

The system cannot find the path specified.
NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code
'0x1'
Stop.

Example 2:

test:
cd .\test
dir


C:\>nmake test

Microsoft (R) Program Maintenance Utility Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.

cd test
dir
Volume in drive C has no label.
Volume Serial Number is 5402-4822

Directory of C:\FIRMWARE\test

01/23/2008 04:02 PM <DIR> .
01/23/2008 04:02 PM <DIR> ..
Drew
2008-01-24 18:37:19 UTC
Permalink
Post by Ravi
Post by Andy Sinclair
Post by Ravi
In the makefile, I want to have an action to change the directory. For
cd..
But when I run "nmake changedir" it prints out "cd.." to the Dos
Window, but it doesn't switch to the parent directory
-- it just remains in the same subdirectory.
Is it possible to do this?
The current directory is changing, but only in the makefile process.
cd
cd ..
cd
The directory changes while the makefile is running, but the current
directory of the calling process is unaffected.
What are you trying to achieve?
Andy
I need to cd into the directory that contains the obj files and run a
command.
Notice that nmake is placing the "dir" command on the same line as the
"cd" command.
It looks like it is a problem with long file name directory. It works
OK with a short name directory.
cd .\Example_DHC_Application_3.0_Data\Debug\ObjectCode\
dir
Try without the trailing \
If that doesn't work put the path in quotes.

Drew
Post by Ravi
C:\>nmake test
Microsoft (R) Program Maintenance Utility Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.
cd .\Example_DHC_Application_3.0_Data\Debug\ObjectCode dir
The system cannot find the path specified.
NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code
'0x1'
Stop.
cd .\test
dir
C:\>nmake test
Microsoft (R) Program Maintenance Utility Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.
cd test
dir
Volume in drive C has no label.
Volume Serial Number is 5402-4822
Directory of C:\FIRMWARE\test
01/23/2008 04:02 PM <DIR> .
01/23/2008 04:02 PM <DIR> ..
Loading...