Page 1 of 1 1
Topic Options
#117617 - 2004-04-09 03:05 AM SHELL/COMSPEC Help on Calling Advanced CMD/BAT
JeremyP Offline
Fresh Scripter

Registered: 2001-11-06
Posts: 5
Loc: USA
Using the SHELL Command, I am having serious trouble in getting this "Command Line" to work from within my script,
A simple MENU type script asking for particular information then sends the info to the command line.

It creates a LOOP process at the command prompt, and the Token is added to from the information in the '(workstations.txt)' file until it reaches the end of the file. It calls the particular program to RUN each time it finished the previous item in the file. This works PERFECTLY on the command line, but I NEED to get to run from an option on a menu style script I am writing. I either get:

"Not recognized internal/file error" or It does nothing.

*** ACTUAL COMMAND LINE USAGE ***

for /F "tokens=1" %i in (workstations.txt) do call vnc7 %i /user username password /log /ultra

**********************************

ANY Help would be greatly appreciated, This Site and Kixtart is the BEST application I use in my Organization for LOCKING down my Computers!


I have looked and searched, but have had NO luck in getting that line to work with either using the CHR(34), Triple Quotes, anything I can think of.. The Shell Command Line is in the above post.

This is the results I get from this code:
Code giving the error below:

*************************************
Shell $CMD + "c:\fastpush\for /F " + "tokens=1" + " %i in ($WSListing) do call vnc7 %i /user $AdminUser $AdminPW /log /ultra"
*************************************
ERROR MESSAGE:
'c:\fastpush\for' is no
t recognized as an internal or external command,
operable program or batch file.

This is an Advanced CMD Command "for" in the CMD Compspec. It runs a Batch file as well. The "TOKENS=1" Must be in Quotes inside the command line as well, while the other instructions are VARs from Kixtart and command line switches.

I have gone and read the FAQs, but I am sure I am not doing something right.

Also, from what I have found was that the ' %1' part needed to be '%%1' to be used in a called batched file, not as an actual command at the prompt. I still get the same error as above. I am trying to figure out How to put the QUOTES around the '"tokens=1"' area with the rest of the command, is that possible?

Top
#117618 - 2004-04-09 03:33 AM Re: SHELL/COMSPEC Help on Calling Advanced CMD/BAT
Chewmanfoo Offline
Fresh Scripter

Registered: 2002-07-29
Posts: 19
Loc: Milpitas
May want to give this a try.

"
To use the FOR command in a batch program, specify %%variable instead
of %variable. Variable names are case sensitive, so %i is different
from %I."

Also you may want to try

Code:
  

cd \fastpush\
Shell "%comspec% /c for /F " + "tokens=1" + " %%i in ($WSListing) do call vnc7 %%i /user $AdminUser $AdminPW /log /ultra"



Edited by Chewmanfoo (2004-04-09 03:39 AM)

Top
#117619 - 2004-04-09 05:15 AM Re: SHELL/COMSPEC Help on Calling Advanced CMD/BAT
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Read the FAQs about RUN/SHELL and use of quotes and try this:

Code:

shell '%COMSPEC% for /F "tokens=1" %i in (workstations.txt) do call vnc7 %i /user username password /log /ultra'


and add a /c after %COMSPEC% once it works.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


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

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

Generated in 0.056 seconds in which 0.03 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