Page 1 of 1 1
Topic Options
#5889 - 2000-12-20 04:15 PM Redirecting to file
Anonymous
Unregistered


From a command line I can run "net use > %temp%\%username%-drives.txt" to output to a file. Within a kixtart script how do I use "USE LIST" and have the results redirected to "%temp%\%username%-drives.txt"?

Top
#5890 - 2000-12-20 04:19 PM Re: Redirecting to file
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
OWL:

How about...

shell '%comspec% /c net use >"%temp%\%username%-drives.txt" 2>nul'

Shawn.


Top
#5891 - 2000-12-20 05:48 PM Re: Redirecting to file
Anonymous
Unregistered


I was just going to post a question on something similar.

I could not get any redirection to work.
I wanted to use it for a script in 2000 Server to xcopy c:*.* d: > text.txt just to verify it works. From a command prompt it does work but within the script it does not!

Top
#5892 - 2000-12-20 06:09 PM Re: Redirecting to file
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Prowler:

So does it work now ?

If not - let's see your KiX script...


So - how's things in good old Windsor, Ont ?

Shawn (from Toronto, Ont)

[This message has been edited by Shawn (edited 20 December 2000).]

Top
#5893 - 2000-12-21 03:28 PM Re: Redirecting to file
Anonymous
Unregistered


Actually I hear things are rather cold in Windsor. I am now a Torontonian now!

here is the script
---------------------------------------

shell ("dgtime > lastlog.txt")
shell ("xcopy /s /e /h /k /c /v d:\data\*.* \\server\backups >lastlog.txt")

---------------------------------------
the program dgtime just outputs the time
these lines work on a command line no problems.

If I watch the script it outputs the time to the screen not to the file.

BTW I am using 2000 server to run this script in scheduler.

Top
#5894 - 2000-12-21 03:41 PM Re: Redirecting to file
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Prowler:

Output redirection is a feature of the shell program cmd.exe (command.exe on Win9x) so you have to say this...

shell ("%comspec% /c dgtime > lastlog.txt")
shell ("%comspec% /c xcopy /s /e /h /k /c /v d:\data\*.* \\server\backups >lastlog.txt")

Yeah - it's darn cold in T.O. today - hope it clears up for the holidays !

Luck !

Shawn.



Top
#5895 - 2000-12-21 08:32 PM Re: Redirecting to file
Anonymous
Unregistered


Hey thanks,

That worked great...

what does %comspec% /c actually do?
and why would the commands work without it?

I am glad I only have to walk a short way from my car to the subway! -5C is a tad cold.

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 834 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.049 seconds in which 0.02 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