Jump to content

Trouble With @comspec


 Share

Recommended Posts

I am trying to get to a DOS prompt in order to rename a folder and copy a new one from a network share. I use:

RunWait (@ComSpec & "/c rename C:\scripts old") and I get the following error

Error Unable to execute the external program. The system cannot find the path specified.

Where am I going wrong?

Link to comment
Share on other sites

well, in my own comspec hastle string, I learned you need a space in front of the /c

RunWait (@ComSpec & " /c rename C:\scripts old")

but why not just use the DirMove and DirCopy commands already built in?

From the help file:

DirMove

--------------------------------------------------------------------------------

Moves a directory and all sub-directories and files.

DirMove ( "source dir", "dest dir" [, flag])

Parameters

source dir Path of the source directory (with no trailing backslash). eg. "C:\Path1"

dest dir Path of the destination dir (with no trailing backslash). eg. "C:\Path_Copy"

flag [optional] this flag determines whether to overwrite files if they already exist:

0 = (default) do not overwrite existing files

1 = overwrite existing files

DirCopy

--------------------------------------------------------------------------------

Copies a directory and all sub-directories and files (Similar to xcopy).

DirCopy ( "source dir", "dest dir" [, flag])

Parameters

source dir Path of the source directory (with no trailing backslash). eg. "C:\Path1"

dest dir Path of the destination dir (with no trailing backslash). eg. "C:\Path_Copy"

flag [optional] this flag determines whether to overwrite file if they already exist:

0 = (default) do not overwrite existing files

1 = overwrite existing files

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

  • Developers

RunWait (@ComSpec & "/c rename C:\scripts old")   

Where am I going wrong?

You need a SPACE before the /c

RunWait (@ComSpec & " /c rename C:\scripts old")
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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