Page 1 of 1 1
Topic Options
#120872 - 2004-06-08 07:05 PM Why does DIR not work through SHELL or RUN
Ash Offline
Fresh Scripter

Registered: 2004-05-05
Posts: 9
All,

I'm trying to run a shell command to actually do a DIR in a directory and redirect the output into a file, like so:

dir /b c:\kix\*.csv > c:\kix\log.txt

when i execute through RUN or SHELL, just get error code 2. If i cut it down to a simple dir > log.txt still the same problem.

Any ideas, much appreciated. I could do this in a DOS batch file, before launching KIX, but would prefer to do it all within KIX

Thanks

Ash

Top
#120873 - 2004-06-08 07:21 PM Re: Why does DIR not work through SHELL or RUN
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Well, you don't show us how you are coding it with SHELL. I presume you are missing the command interpreter needed for redirect to work. There is a FAQ on that.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#120874 - 2004-06-08 07:22 PM Re: Why does DIR not work through SHELL or RUN
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
This works for me:

Code:
shell '%comspec% /c "dir > c:\kix\log.txt"'

_________________________
Eric

Top
#120875 - 2004-06-08 07:24 PM Re: Why does DIR not work through SHELL or RUN
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
THat is the "short" answer but do not agree with your use of quotes. There is another FAQ on that too.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#120876 - 2004-06-08 07:35 PM Re: Why does DIR not work through SHELL or RUN
Ash Offline
Fresh Scripter

Registered: 2004-05-05
Posts: 9
Les,

Thanks for the reply - looked in the FAQ section of the forum, but no info - am i looking in the wrong place....?

Exact code is:

shell "dir /b c:\kix\*.csv > c:\kix\testlog.txt"

error code 2 returned

Many thanks again

Ashley

Top
#120877 - 2004-06-08 07:41 PM Re: Why does DIR not work through SHELL or RUN
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
From our Main Index - http://www.kixtart.org/ubbthreads/ubbthreads.php?Cat=

you should see - KiXtart FAQ & How to's - http://www.kixtart.org/ubbthreads/postlist.php?Cat=&Board=UBB10

If you do not see 3 pages of FAQs, change your "Show" option as explained in the sticky - Cannot find what you are looking for? -
http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Number=81588&page=0&view=collapsed&sb=5&o=&fpart=1
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#120878 - 2004-06-08 07:42 PM Re: Why does DIR not work through SHELL or RUN
Stanley Offline
Starting to like KiXtart

Registered: 2004-06-03
Posts: 130
Loc: Upstate NY, USA
I use
SHELL "CMD /C DIR C:\FOLDER /b /l > C:\temp\output.txt"

Stanley
_________________________
Taxation WITH representation isn't so hot, either!

Top
#120879 - 2004-06-08 07:44 PM Re: Why does DIR not work through SHELL or RUN
Ash Offline
Fresh Scripter

Registered: 2004-05-05
Posts: 9
Stanley,

Many thanks, it now works perfectly!

Thanks again

Ash

Top
#120880 - 2004-06-08 07:48 PM Re: Why does DIR not work through SHELL or RUN
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Better to use %COMSPEC% than to hard code CMD.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#120881 - 2004-06-08 10:11 PM Re: Why does DIR not work through SHELL or RUN
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and to finally read the faqs.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1471 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.062 seconds in which 0.028 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org