Jump to content

Recommended Posts

Posted (edited)

Hi,

I am making a script to have 2 files get registred with setver.

This is my script:

$file = FileOpen("C:\Windows\System32\CONFIG.NT", 1)
FileWriteLine($file, "device=c:\windows\system32\setver.exe")
FileCopy("C:\test\Restore.exe", "C:\Windows\System32\*.*")
FileCopy("C:\test\Backup.exe", "C:\Windows\System32\*.*")
Sleep(2000)
Send("#r")
Sleep(2000)
Send("setver backup 6.22{enter}")
Sleep(2000)
Send("#r")
Sleep(2000)
Send("setver restore 6.22{enter}")
Sleep(5000)

In wich i get the following error:

Posted Image

Sorry its in Dutch, but i says:

The systemfile is not compatible for MS-DOS and Microsoft Applications, Choose close for closing the application.

If i type setver restore 6.22 in START > RUN it does work.

I think i need to use an other function.

Could someone help me please?

Edited by Iznogoud
Posted

Perhaps the setver command can only be run before Windows is loaded, in which case you would need to script a DOS batch file to do the job.

Posted

Perhaps the setver command can only be run before Windows is loaded, in which case you would need to script a DOS batch file to do the job.

<{POST_SNAPBACK}>

If i am in Windows Xp in this case and i do START > Run > setver backup 6.22

It will run correctly. If i do START > Run > CMD and enter setver backup 6.22 in the screen it will work also.

But as soon as i do:

run("cmd.exe")

Send("setver backup 6.22{enter}") it will give this error also.

It has something to do with AutoITscript but i don't know what.

Posted

If i am in Windows Xp in this case and i do START > Run > setver backup 6.22

It will run correctly. If i do START > Run > CMD and enter setver backup 6.22 in the screen it will work also.

But as soon as i do:

run("cmd.exe")

Send("setver backup 6.22{enter}") it will give this error also.

It has something to do with AutoITscript but i don't know what.

<{POST_SNAPBACK}>

nobody?
  • Developers
Posted (edited)

nobody?

<{POST_SNAPBACK}>

Why do you open the CONFIG.NT and write the Device= line?

You are not closing CONFIG.NT before doing the run so the file is open and not available..... it will close when the program ends and thus will the commandline work again......

So just do a FileClose($file) before Sending #R.

You could also do a RUNWAIT(@comspec & " /c setver backup 6.22") in stead of the #R

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

Posted

Why do you open the CONFIG.NT and write the Device= line?

You are not closing CONFIG.NT before doing the run so the file is open and not available..... it will close when the program ends and thus will the commandline work again......

So just do a FileClose($file) before Sending #R.

You could also do a RUNWAIT(@comspec & " /c setver backup 6.22")  in stead of the #R

<{POST_SNAPBACK}>

Yes thank you, this was a solution. I already tried some different things, in wich i have made multiple scripts combined in one script.

One script starts first the writeline(script wil end and closed the file) then the 2nd script started for the last part.

If i used fileclose i was also done :dance:

Damn i am getting addicted to AutoIT :whistle:

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
  • Recently Browsing   0 members

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