Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
Docfxit
- Posts: 132
- Joined: 12 Nov 2015 12:42
#1
Post
by Docfxit » 13 May 2020 11:42
I would like to get Unlocker working.
My preference would be to get Unlocker to delete files from a list of files that are written to a file.
I can't seem to get Unlocker working from a batch file no matter what command line parameters I give it.
In these examples none of them work when I start the bat file with Run As Administrator.
Code: Select all
@Echo Off
C:\Programs\Unlocker\Unlocker.exe "C:\Dnload\9xAddons\UnlockerListofFiles.txt" /O /L /D
C:\Programs\Unlocker\Unlocker.exe "C:\$WINDOWS.~BT\Sources\SetupPlatform.ini" /D
cd\Programs\Unlocker
Unlocker.exe "C:\$WINDOWS.~BT\Sources\SetupPlatform.ini" /O /L /D
if not exist "C:\$WINDOWS.~BT\Sources\Panther\." (
Echo "C:\$WINDOWS.~BT\Sources\Panther" Was Deleted
)
C:\Programs\Notepad++\notepad++.exe C:\Programs\Unlocker\Unlocker-Log.txt
cmd/k
What I have in the txt file "UnlockerListofFiles.txt"
Code: Select all
C:\$WINDOWS.~BT\Sources\example.au3
C:\$WINDOWS.~BT\Sources\Panther
C:\$WINDOWS.~BT\Sources\ProcessEx.au3
C:\$WINDOWS.~BT\Sources\SetupPlatform.ini
- UnlockerCommandLine.jpg (81.39 KiB) Viewed 6478 times
Thanks,
-
jfl
- Posts: 226
- Joined: 26 Oct 2012 06:40
- Location: Saint Hilaire du Touvet, France
-
Contact:
#2
Post
by jfl » 16 May 2020 02:48
What you need is a (for /f ...) command. Ex:
Code: Select all
for /f "delims=" %%f in ("UnlockerListofFiles.txt") do (
C:\Programs\Unlocker\Unlocker.exe "%%~f"
)
-
Docfxit
- Posts: 132
- Joined: 12 Nov 2015 12:42
#3
Post
by Docfxit » 16 May 2020 11:03
Thank you for the suggestion...
I modified your code a little to prove it was working as expected:
Code: Select all
for /f "delims=" %%f in ("UnlockerListofFiles.txt") do (
Echo "%%~f"
C:\Programs\Unlocker\Unlocker.exe "%%~f"
)
In the cmd window this is what I got:
Code: Select all
C:\Programs\Unlocker>for /F "delims=" %f in ("UnlockerListofFiles.txt") do (
Echo "%~f"
C:\Programs\Unlocker\Unlocker.exe "%~f"
)
C:\Programs\Unlocker>(
Echo "UnlockerListofFiles.txt"
C:\Programs\Unlocker\Unlocker.exe "UnlockerListofFiles.txt"
)
"UnlockerListofFiles.txt"
What I expected was for each line within the file UnlockerListofFiles.txt to be listed.
I think you also wanted to add the paramater " /D" so it would delete the files.
Thanks,
-
ShadowThief
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
#4
Post
by ShadowThief » 16 May 2020 14:45
Based on the picture you've shown, you need the /S option to hide the GUI, and the file containing the files to unlock goes
after the /L option.
Code: Select all
unlocker.exe /L UnlockerListofFiles.txt /O /D /S
-
Docfxit
- Posts: 132
- Joined: 12 Nov 2015 12:42
#5
Post
by Docfxit » 16 May 2020 15:03
ShadowThief wrote: ↑16 May 2020 14:45
Based on the picture you've shown, you need the /S option to hide the GUI, and the file containing the files to unlock goes
after the /L option.
Code: Select all
unlocker.exe /L UnlockerListofFiles.txt /O /D /S
Great observation. I still couldn't get it to delete the files/partition.
The next thing I tried was:
Code: Select all
C:\Programs\Unlocker\Unlocker.exe /L "C:\Dnload\9xAddons\UnlockerListofFiles.txt" /O /D /S
It didn't work either. and I did run it As Administrator.
The user I am has Administrator rights.
Thanks,
-
ShadowThief
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
#6
Post
by ShadowThief » 16 May 2020 18:08
Based on my tests, it seems that you need the -option format instead of the /option format for flags.
Code: Select all
unlocker.exe "list_of_files.txt" -L -S -D -O
deleted the files listed and created an output log, but
Code: Select all
unlocker.exe "list_of_files.txt" /L /S /D /O
did nothing.
-
Docfxit
- Posts: 132
- Joined: 12 Nov 2015 12:42
#7
Post
by Docfxit » 16 May 2020 19:13
ShadowThief wrote: ↑16 May 2020 18:08
Based on my tests, it seems that you need the -option format instead of the /option format for flags.
Code: Select all
unlocker.exe "list_of_files.txt" -L -S -D -O
deleted the files listed and created an output log
You are a miracle worker. That works perfect.
I tried dashes before. I must have not had the correct combination.
You did really great. Thank you very very much.
Docfxit