Outbreaker Posted January 7, 2009 Share 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 Link to comment Share on other sites More sharing options...
strel Posted January 7, 2009 Share Posted January 7, 2009 I think that start /Dpath command should work. Link to comment Share on other sites More sharing options...
Outbreaker Posted January 7, 2009 Author Share Posted January 7, 2009 Batch commands don't work in Registry Keys. Link to comment Share on other sites More sharing options...
Yzöwl Posted January 7, 2009 Share 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. Link to comment Share on other sites More sharing options...
Outbreaker Posted January 7, 2009 Author Share 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 Link to comment Share on other sites More sharing options...
Yzöwl Posted January 7, 2009 Share 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. Link to comment Share on other sites More sharing options...
Outbreaker Posted January 7, 2009 Author Share 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. Link to comment Share on other sites More sharing options...
Yzöwl Posted January 7, 2009 Share 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. Link to comment Share on other sites More sharing options...
Outbreaker Posted January 8, 2009 Author Share 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 Link to comment Share on other sites More sharing options...
Yzöwl Posted January 8, 2009 Share 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! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now