Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop lcd malware memory modem monitor motherboard network printer problem ram registry router slow software sound toshiba trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > Windows Vista >
Solved: Batch Directory Help

Reply  
Thread Tools
Psycoblast's Avatar
Computer Specs
Member with 45 posts.
 
Join Date: Aug 2009
Experience: Advanced Batch Not Expert
01-Aug-2009, 06:57 PM #1
Question Solved: Batch Directory Help
Ok guys this is kind of a stupied question but I've been upgrading my usb I made a Autorun that runs another batch program I made called choice. The problem is that if I put the command line:

start "F:/USB Folder"

It opens a Command Prompt Window with the title the location.

I know that if I made choice goto a different folder then put a shortcut of "USB Folder" in that folder with it, it works just fine but I can't because of the folder lock trick. Here's Choice.bat 's code.


Choice.bat

@echo off
:start
cls
echo Please Enter Command
echo.
echo 1) Open USB Folder
echo 2) Unlock
echo 3) Lock
echo 4) Admin Controls
echo.
set /p "c=>"
IF %c%==1 start "F:\USB Folder"
IF %c%==2 goto QUnlock
IF %c%==3 goto QLock
goto end

:QUnLock
cls
IF Exist "USB Folder" goto nounlock
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto Unlock
goto end

:UnLock
cls
echo Enter password to Unlock folder
set /p "pass=>"
if NOT %pass%==psycoblast goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" "USB Folder"


echo. >> "F:\USB Folder\~sys~\logtext.txt"
echo. ----------Unlocked_First_Try--------->> "F:\USB Folder\~sys~\logtext.txt"
echo. |time |find "current" >> "F:\USB Folder\~sys~\logtext.txt"
echo. |date |find "current" >> "F:\USB Folder\~sys~\logtext.txt"
echo. >> "F:\USB Folder\~sys~\logtext.txt"
echo Folder unlocked successfully
ping localhost -n 2 >nul
start "F:\USB Folder"
goto end

:FAIL
cls
echo Invalid password
goto UNLOCK2
:FAIL2
cls
echo. >> "F:\USB Folder\~sys~\logtext.txt"
echo. ----------Wrong_Pass_#2---------->> "F:\USB Folder\~sys~\logtext.txt"
echo. |time |find "current" >> "F:\USB Folder\~sys~\logtext.txt"
echo. |date |find "current" >> "F:\USB Folder\~sys~\logtext.txt"
echo. Pass Entered: %pass% >> "F:\USB Folder\~sys~\logtext.txt"
echo. >> "F:\USB Folder\~sys~\logtext.txt"
echo Invalid password
goto end
:UNLOCK2
cls
echo. >> "F:\USB Folder\~sys~\logtext.txt"
echo. ----------Wrong_Pass---------->> "F:\USB Folder\~sys~\logtext.txt"
echo. |time |find "current" >> "F:\USB Folder\~sys~\logtext.txt"
echo. |date |find "current" >> "F:\USB Folder\~sys~\logtext.txt"
echo. Pass Entered: %pass% >> "F:\USB Folder\~sys~\logtext.txt"
echo. >> "F:\USB Folder\~sys~\logtext.txt"
echo Last chance to enter correct password to unlock folder
set /p "pass=>"
if not %pass%==psycoblast goto FAIL2
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" "USB Folder"
echo. >> "F:\USB Folder\~sys~\logtext.txt"
echo. ----------Unlocked_Second_Try--------->> "F:\USB Folder\~sys~\logtext.txt"
echo. |time |find "current" >> "F:\USB Folder\~sys~\logtext.txt"
echo. |date |find "current" >> "F:\USB Folder\~sys~\logtext.txt"
echo. >> "F:\USB Folder\~sys~\logtext.txt"
echo Folder unlocked successfully




:QLock
cls
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto nolock
echo Are You Sure You Want To Lock The Folder??? y/n
echo.
set /p "Lockchoice=>"
IF %Lockchoice%==n goto start
:Lock
cls
echo. >> "F:\USB Folder\~sys~\logtext.txt"
echo. ----------Locked---------->> "F:\USB Folder\~sys~\logtext.txt"
echo. |time |find "current" >> "F:\USB Folder\~sys~\logtext.txt"
echo. |date |find "current" >> "F:\USB Folder\~sys~\logtext.txt"
echo. >> "F:\USB Folder\~sys~\logtext.txt"
ren "USB Folder" "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto start

:nolock
cls
echo Already Locked
pause >nul
goto start

:nounlock
cls
echo Already Unlocked
pause >nul
goto start
:end
TheOutcaste's Avatar
Computer Specs
Distinguished Member with 9,048 posts.
 
Join Date: Aug 2007
Location: Oregon, USA
Experience: Intermediate
02-Aug-2009, 04:08 AM #2
Welcome to TSG!

Use Start "" "F:\USB Folder"

If the first item on the command line has quotes, Start assumes it is a title, so if you are using a path that needs quotes you have to add the "" first.

You can echo the time and date much easier by using the %time% and %date% variables:
Echo %Date% %Time% >>"F:\USB Folder\~sys~\logtext.txt"
Also be aware that Vista now includes choice.exe, which XP didn't have, so you might end up running that instead of your batch file if you don't specify the .bat extension and are depending on finding your file using the PATH. Usually best to avoid using a name that is the same as an existing command/file.
__________________
Microsoft MVP - Windows Expert - Consumer
Of course I know all the answers ; I just don't always match the answers to the right questions

Reply

Tags
bit, folder, start, usb, vista

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:14 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.