Jump to content

Send a command on cmd.exe error


Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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. :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...