Jump to content

Recommended Posts

Posted (edited)

HI :)

Is it possible to Auto start a file with a Registry Key in RunOnce and set also the Working Directory for this file ?

Edited by Outbreaker

Posted

Of course they do…

@REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v TestEntry^
/d "CMD /C START /DC:\MyDocDir\ /MAX NOTEPAD.EXE">Nul

Just copy and paste this as two lines and save.

Posted (edited)

THX.

Only one problem if ther is a space in the executable file then i can't get this to work.

REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v TestEntry /d "CMD /C START /D"C:\MyDocDir" /MAX "Auto Installer.bat">Nul

EDIT:

OK i read that this will not work.

A workaround would be to rename the file to Auto_Installer.bat or to use the 8.3 compatible name AUTOIN~1.bat

Edited by Outbreaker
Posted

Yes it will work!

@REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v TestEntry^
/d "CMD /C START \"\" /DC:\Path\YourDir\ \"File Name.ext\"">Nul

As before paste the two lines into a new file and save as test_ent.cmd or similar.

Posted

Spaces are supported have you actually tried using the example I provided, you only need to change the paths and names etc. to suit your own.

@REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v TestEntry^
/d "CMD /C START \"\" /DC:\Users\Yz”wl\ \"E:\File Name.bat\"">Nul

The above has been tested successfully by me.

However, I see little point in using the start command path switch for setting the working directory of a batch file, that could be set directly in that batch file.

Posted

OK strange on the internet i find users that say it will not work but now i found out that this was the error:

Not:

START

But:

START \"\"

grrr

THX for your help :)

Posted

The problem occurs because you have included double quotes around your file path. What happens is the the Start command sees the double quotes as ["title"] because you haven't already provided one. The usual method of preventing it is to create a title; I just made mine blank!

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

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