Jump to content
Sign in to follow this  
pwolf

Send a command on cmd.exe error

Recommended Posts

pwolf

I've managed to create a script that opens up cmd.exe. Changes directory to the one i want. This has a cmd file called vnc.cmd in there.

When I input this command manually to cmd it works perfectly.

But when I send it via the script it throws up an error.

for /F "tokens=1" %i in (workstations.txt) do call vnc %i /user domain\admin password /log /vnc

The stop error comes at the "tokens Error parsing function call.

I'm shooting in the dark here.

I've tried

Send("!for /F "tokens=1" %i in (C:\vnc\workstations.txt) do call vnc %i /log /vnc")

What am I doing wrong? This command just has to read vnc.cmd

Share this post


Link to post
Share on other sites
smashly

Set the working directory to where ever your workstations.txt is and it should work.. I'm only guessing at this.

But the line passes without error when I tried it with a dummy file in the working directory path.

Run(@ComSpec & ' /k ' & 'for /F "tokens=1" %i in (workstations.txt) do call vnc %i /user domain\admin password /log /vnc', 'C:\Program Files\VNC\', @SW_SHOW)

Cheers

Share this post


Link to post
Share on other sites
pwolf

Thanks

That worked a treat for me.

Yes I got the code set up ok to get me to the directory on the cmd.

The piece of code you put above sorted the last part of this.

Now I can tidy up the code and make the gui look the part. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×