Outbreaker Posted January 7, 2009 Posted January 7, 2009 (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 January 7, 2009 by Outbreaker
Outbreaker Posted January 7, 2009 Author Posted January 7, 2009 Batch commands don't work in Registry Keys.
Yzöwl Posted January 7, 2009 Posted January 7, 2009 Of course they do…@REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v TestEntry^ /d "CMD /C START /DC:\MyDocDir\ /MAX NOTEPAD.EXE">NulJust copy and paste this as two lines and save.
Outbreaker Posted January 7, 2009 Author Posted January 7, 2009 (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">NulEDIT: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 January 7, 2009 by Outbreaker
Yzöwl Posted January 7, 2009 Posted January 7, 2009 Yes it will work!@REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v TestEntry^ /d "CMD /C START \"\" /DC:\Path\YourDir\ \"File Name.ext\"">NulAs before paste the two lines into a new file and save as test_ent.cmd or similar.
Outbreaker Posted January 7, 2009 Author Posted January 7, 2009 Nop i have also test this but it won't work because spaces are not supported in file names with this command.
Yzöwl Posted January 7, 2009 Posted January 7, 2009 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\"">NulThe 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.
Outbreaker Posted January 8, 2009 Author Posted January 8, 2009 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:STARTBut:START \"\"grrrTHX for your help
Yzöwl Posted January 8, 2009 Posted January 8, 2009 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!
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now