I am trying to run a batch file on USB (G:\lock.bat) from e:\min.bat which creates a folder lock on usb. My issue is the folder has been created but on E drive instead of the USB drive.
min.bat
@echo off
IF EXIST %SYSTEMROOT%\System32\TSKILL (
TSKILL RunSanDiskSecure*
) ELSE (
TaskKill /IM firefox* /F
TaskKill /IM RunSanDiskSecure* /F )
setLocal Enabledelayedexpansion
set "myDrive="
for %%a in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do (
if not defined myDrive vol %%a: >nul 2>nul && (
if exist "%%a:\RunSanDiskSecureAccess_Win.exe" set "myDrive=%%a:"
)
)
if defined myDrive (
echo drive found [%myDrive%]
) else (
echo USB drive has not been found
)
%myDrive%
pushd %~d0
Call lock.bat
pause
endlocal
exit
lock.bat
cls
@ECHO OFF
title IMAGES LOCKED
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST IMAGES goto MDIMAGES
ren IMAGES "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to Unlock Your Secure Folder
set/p "pass=>"
if NOT %pass%== pass123 goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" IMAGES
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDIMAGES
md IMAGES
echo IMAGES created successfully
goto End
:End
I can see the drive of my usb but when called to activate the lock.bat it still creating the folder on E: drive not on USB drive.