|
Answer» 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!
Quote from: zask on March 24, 2016, 05:20:50 PM 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.
I didn't read any further than to see that VBS is being used. Why not use a batch script in the startup group?The vbs file is used to start a specific batch file invisible, the vbs file is generated from the batch file, which is suppose to be a install batch file Why invisible? What's the point in this?
It looks like what you've described is not what you want, or what you're doing.because i dont want to display the prompt when the batch file starts. The file doesn't require user input nor does it display any messages. there is no point in displaying the cmd window so i run it invisible instead. When i add a options menu, i wish to display that file instead because it does require a visual prompt to use, and i do not wish to display two prompts just because i wish to run a file in a specific folder from that options menu. The vbs code works fine, the problem is when i create the vbs file from the batch file, specific spacial characters is needed to be ignored or else when the batch file creates the vbs file, the code in that vbs file will not display that character and thus resulting in an error when the vbs file is started. the command line wont let me ignore that character because the "&" sign has to be ignored with the "^" sign, but also the "^" (For example ~ "^&") must also be canceled out (For example ~ "^^&") i cannot ignore the fist "^" sign in "^^&" because it interferes with the other "^" sign in "^&", and thus again resulting in an error.This for general reference:
Programs or shortcuts placed in the Startup folder will run whenever Windows starts. Click the Start button , click All Programs, right-click the Startup folder, and then click Open. Open the location that contains the item to which you want to create a shortcut. Right-click the item, and then click Create Shortcut.
Most likely Zask will ignore this simple answer. Quote from: zask on March 24, 2016, 06:15:59 PMbecause i dont want to display the prompt when the batch file starts.
zask, if you want people to use their free time to help you, then be up front with what you want to do.
If you want to start chrome when your computer starts - without a batch window showing - then drag a shortcut from chrome into your startup group.
If you want help to use a character in a line of code, then just show the line of code and ask your question.i am being front, all i need to know is how to ignore a ^ sign in front of ^& Quote from: zask on March 26, 2016, 06:31:40 PMi am being front, all i need to know is how to ignore a ^ sign in front of ^&
Code: [Select]@echo off echo >"%TEMP%\start.bat" @echo off echo >>"%TEMP%\start.bat" start chrome.exe
echo >"%TEMP%\makevbs.bat" @echo off echo >>"%TEMP%\makevbs.bat" set "file=%%APPDATA%%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs" echo >>"%TEMP%\makevbs.bat" echo ^>"%%file%%" Set WshShell = CreateObject("WScript.Shell") echo >>"%TEMP%\makevbs.bat" echo ^>^>"%%file%%" WshShell.Run chr(34) ^^^& "%%%%TEMP%%%%\start.bat" ^^^& Chr(34), 0 echo >>"%TEMP%\makevbs.bat" echo ^>^>"%%file%%" Set WshShell = Nothing Quote from: Geek-9pm on March 24, 2016, 08:55:53 PMThis for general reference:
Programs or shortcuts placed in the Startup folder will run whenever Windows starts. Click the Start button , click All Programs, right-click the Startup folder, and then click Open. Open the location that contains the item to which you want to create a shortcut. Right-click the item, and then click Create Shortcut.
Most likely Zask will ignore this simple answer.
Works! :/Quote from: zask on March 31, 2016, 04:42:11 PMWorks! :/
This is perfect! Here's an image you can use as an icon, zask.
http://www.educationduepuntozero.it/Risorse/Racconti-ed-esperienze/2010/09/img/clandestini16_big.jpg Quote from: foxidrive on April 01, 2016, 06:38:10 AMHere's an image you can use as an icon, zask.
http://www.educationduepuntozero.it/Risorse/Racconti-ed-esperienze/2010/09/img/clandestini16_big.jpg
Funny lol
|