| 1. |
Solve : help!!!!!! i cant find how to open a shortcut on the same drive as the .bat file? |
|
Answer» im writing a BATCH file and i cant find anywhere that will show me a peice of code that will open a shortcut that is on the same drive and folder as the bat file never mind about that now ive just rememberd it so my other qustion is what peice of code can determin if a disk drive exists Code: [Select]if exist "c:\" echo Drive C existsQuote Code: [Select]if exist "c:\" echo Drive C exists You should add this after that. Code: [Select]if not exist "c:\" echo Drive C doesn't exist So then if it doesn't exist it at LEAST gives a message instead of the PROGRAM just exiting out. Quote from: BatchFileCommand on January 03, 2009, 09:40:47 AM QuoteCode: [Select]if exist "c:\" echo Drive C exists maybe, but this is the original question Quote what peice of code can determin if a disk drive exists Even better Code: [Select]if exist "c:\" (echo Drive C exists) ELSE (echo Drive C does not exist) ive been using al of this code for a bat file for my memory stick so when i plug the usb flash drive in the bat file opens and cheaks for other memory sticksJust so you know, .lnk files are in a registry along with a list of other extensions that don't show up. As long as that script exists, you can't see the extension (neither can DOS), so you can't open it except by Double-Clicking. A random number in a range? EASY! Code: [Select]@echo off :number set number=%random% rem The above line is so %random% will remain as long as we need. if %number% GEQ %bottomrange% goto 1 rem %bottomrange% is the bottom number. The number can be %bottomrange% and up. goto number :1 if %number% LEQ %toprange% echo %number% rem %toprange% is the maximum number. The numbers will be that number AND below it. goto number Replace %bottomrange% and %toprange% with the bottom and the top of your range. You can remove the REM if you like. Its just there to explain how the code works. |
|