Okay I will make a brief explanation on showing what i'm trying to do. I'm trying to make a program that will start google chrome for me each time
the computer starts.
Okay first I have a simple vbs file that runs a file name start.bat invisible.
Set WshShell = CreateObject("WScript.Shell" )
WshShell.Run chr(34) & "%TEMP%\Nigflikr\start.bat" & Chr(34), 0
Set WshShell = Nothing
I'm going to put this vbs file inside the batch file and run it. to do this i have to ignore the "&" character by placing the "^" character in front of it.
@echo off
echo @echo off >> "%TEMP%\start.bat"
echo start chrome.exe >> "%TEMP%\start.bat
echo Set WshShell = CreateObject("WScript.Shell" ) >> "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs"
echo WshShell.Run chr(34) ^& "%TEMP%\start.bat" ^& Chr(34), 0 >> "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs"
echo Set WshShell = Nothing >> "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs"
now I was messing with the code, and i would like to add more options as well as a menu, was i was wondering if i could also place the file from startup in the temp folder as well.
@echo off
echo @echo off >> "%TEMP%\start.bat"
echo echo start chrome.exe >> "%TEMP%\start.bat
echo @echo off >> "%TEMP%\startup.bat"
echo echo Set WshShell = CreateObject("WScript.Shell" ) ^>^> "%%APPDATA%%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs" >> "%temp%\startup.bat"
echo echo WshShell.Run chr(34) ^& "%TEMP%\start.bat" ^& Chr(34), 0 ^>^> "%%APPDATA%%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs" >> "%temp%\startup.bat"
echo echo Set WshShell = Nothing ^>^> "%%APPDATA%%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs" >> "%temp%\startup.bat"
The only problem is that the out put spits out this code (startup.bat) in the temp folder.
@echo off
echo Set WshShell = CreateObject("WScript.Shell" ) >> "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs"
echo WshShell.Run chr(34) & "%TEMP%\start.bat" & Chr(34), 0 >> "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs"
echo Set WshShell = Nothing >> "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs"
This means that if have to ignore these "&" characters again so i tried this
echo echo Set WshShell = CreateObject("WScript.Shell" ) ^>^> "%%APPDATA%%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs" >> "%temp%\startup.bat"
echo echo WshShell.Run chr(34) ^^& "%TEMP%\start.bat" ^^& Chr(34), 0 ^>^> "%%APPDATA%%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs" >> "%temp%\startup.bat"
echo echo Set WshShell = Nothing ^>^> "%%APPDATA%%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs" >> "%temp%\startup.bat"
cant do that because it cancels out the first "^" sign right before the "&" sign, so i tried this
echo echo Set WshShell = CreateObject("WScript.Shell" ) ^>^> "%%APPDATA%%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs" >> "%temp%\startup.bat"
echo echo WshShell.Run chr(34) ^^^& "%TEMP%\start.bat" ^^^& Chr(34), 0 ^>^> "%%APPDATA%%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs" >> "%temp%\startup.bat"
echo echo Set WshShell = Nothing ^>^> "%%APPDATA%%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs" >> "%temp%\startup.bat"
still doesn't work.
my goal is to get the output of a batch file in the temp folder named (startup.bat) with this code inside of it.
echo Set WshShell = CreateObject("WScript.Shell" ) >> "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs"
echo WshShell.Run chr(34) ^& "%TEMP%\start.bat" ^& Chr(34), 0 >> "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs"
echo Set WshShell = Nothing >> "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs"
i cant do this because the "^" sign is used to ignore the "&" sign and i need to ignore another "^" sign infront of the other "^" sign next to the "&" sign, like this
"^^&"
^
|
ignore this sign
Can anyone help? Thanks, this has been driving me crazy!