Click to See Complete Forum and Search --> : i need help!!
gotroot
June 10th, 2007, 12:00 AM
im a newb at this programming thing, well anyhow, i was trying out some stuff on CMd and i wanted to know
once i make a script in CMD (ex to load a picture) how can i write a code within that one file to autoload that CMD .bat file when windows boots?
is there a command to place the file in msconfig?or something?!
thanks
newb root
SuperKoko
June 10th, 2007, 03:41 AM
You can put it or a link to it, in the "Start Menu\Programs\Startup" directory.
Then, when a session for your user is launched, it will execute it.
Or, you may create a registry value in HKEY_LOCAL_MACHINE\Software\Windows\CurrentVersion\Run of REG_SZ type, and whose name is whatever you want, and the value is a path to your bat file.
Putting it in the startup directory is more user friendly.
PS: If you need to do that in an installer, you must ensure that you get the path to the startup directory through the SHGetSpecialFolderLocation function, as the path depends on the version and country of Windows.
On my computer, it's "C:\Windows\Menu Démarrer\Programmes\Démarrage".
gotroot
June 11th, 2007, 05:58 PM
You can put it or a link to it, in the "Start Menu\Programs\Startup" directory.
Then, when a session for your user is launched, it will execute it.
Or, you may create a registry value in HKEY_LOCAL_MACHINE\Software\Windows\CurrentVersion\Run of REG_SZ type, and whose name is whatever you want, and the value is a path to your bat file.
Putting it in the startup directory is more user friendly.
PS: If you need to do that in an installer, you must ensure that you get the path to the startup directory through the SHGetSpecialFolderLocation function, as the path depends on the version and country of Windows.
On my computer, it's "C:\Windows\Menu Démarrer\Programmes\Démarrage".
k im trying to do pen penetration testing, so i want when the "USER", myself, dl the file online and runs it, i want the code in the script to place that script itself in the boot sequence when the pc loads...
alexsunny
June 28th, 2007, 01:04 AM
:d
SuperKoko
June 28th, 2007, 04:42 AM
k im trying to do pen penetration testing, so i want when the "USER", myself, dl the file online and runs it, i want the code in the script to place that script itself in the boot sequence when the pc loads...
Putting data into the registry base can be done from a bat script.
set tempError=tempEnvFailed
set XTEMP=%TEMP%
if %XTEMP%!==! set XTEMP=%TMP%
rem if %XTEMP%!==! set XTEMP=c:\windows\temp
:tryTemp
set regf="%XTEMP%\registerStartupApp.reg"
echo REGEDIT4 > %regf%
if errorlevel 1 goto %tempError%
echo [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run] >> %regf%
if errorlevel 1 goto cleanFailed
echo "AutoRegistringApp"="%0" >> %regf%
if errorlevel 1 goto cleanFailed
regedit.exe /s %regf%
:cleanFailed
del %regf%
goto endRegister
:tempEnvFailed
set XTEMP=c:\temp
set tempError=tempFirstFailed
goto tryTemp
:tempFirstFailed
set XTEMP=c:\winnt\temp
set tempError=tempSecondFailed
:tempSecondFailed
set XTEMP=.
set tempError=tempPeriodFailed
goto tryTemp
:tempPeriodFailed
:endRegister
Note: It assumes that %0 is the full path to the batch file, which is not the case if you launch it manually from a command line in the current directory.
If you need it, you can copy the batch file to the temp directory and register it with its full path in the temp directory.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.