Jump to content

Reg Key start a file and set also the Working Directory possible ?


Recommended Posts


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.

Link to comment
Share on other sites

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

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

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

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