Installation
Moderator: DosItHelp
Re: Installation
Zip archives keep the files inside them when they are extracted. So the files will remain inside the ZIP archive once they are extracted to a folder, they aren't moved.
Do you want to check if an archive has been extracted to a folder?
That could be done by checking if a known file exists in the folder.
Do you want to check if an archive has been extracted to a folder?
That could be done by checking if a known file exists in the folder.
-
- Posts: 54
- Joined: 10 Nov 2011 20:40
Re: Installation
Could we have it extract an archive into a folder that it makes, then delete the archive?
Re: Installation
Yes. This will create the folder on the desktop,
md "%userprofile%\desktop\test folder"
Use the same path in the Winrar command to extract the archive to "%userprofile%\desktop\test folder"
Then use the del command to delete the "archive.zip"
md "%userprofile%\desktop\test folder"
Use the same path in the Winrar command to extract the archive to "%userprofile%\desktop\test folder"
Then use the del command to delete the "archive.zip"
-
- Posts: 54
- Joined: 10 Nov 2011 20:40
Re: Installation
Okay now I would like to add a status so the user can see whats happeneing.
Creating Extraction folder...
Is there any way to check if a folder with a given name is in a Dir?
Creating Extraction folder...
Is there any way to check if a folder with a given name is in a Dir?
Re: Installation
MLGsuperGame414 wrote:Okay now I would like to add a status so the user can see whats happeneing.
Creating Extraction folder...
Use the echo command.
Is there any way to check if a folder with a given name is in a Dir?
if exist "d:\dir\folder\" echo folder exists
-
- Posts: 54
- Joined: 10 Nov 2011 20:40
Re: Installation
Can we use else in batch? So if its not there we can let the user know its not there?
Re: Installation
MLGsuperGame414 wrote:Can we use else in batch? So if its not there we can let the user know its not there?
Could you at least attempt to do a little research before asking all these questions. If you would read the help file for a lot of these commands you could probably figure it out on your own or at least search the web for the answer.
Open up a command prompt and type IF /?
-
- Posts: 54
- Joined: 10 Nov 2011 20:40
Re: Installation
Well I did read that and didnt understand but if you want my current code here it is.
Code: Select all
@echo off
set empty=Y
for /F %%G in ('dir /b C:\Users\Compklr\Desktop\not') do set empty=N
IF "%empty%"=="Y" (echo Directory is Empty) else echo Dir is not empty
pause
Re: Installation
With the /a-d it will only check for file and ignore folders inside the test folder.
Code: Select all
@echo off
set "empty=Y"
for /F %%G in ('dir /b /a-d C:\Users\Compklr\Desktop\not') do set "empty=N"
IF "%empty%"=="Y" (
echo Directory is Empty
) else (
echo Dir is not empty
)
pause
-
- Posts: 54
- Joined: 10 Nov 2011 20:40
Re: Installation
Sorry it took my so long to get back to this, it seems i'm having an issue with the syntax when using the move command here is my code.
I'm simply trying to move a text file from my desktop to a folder on my desktop.
I fixed it, I figured the error was the spaces
Now I am denied access though, I'm on the Administrator account too.
Edit:
I then ran it as an administrator and it worked, I'm now curious is there any way around requiring to run as an administrator?
Code: Select all
move /Y C:\Users\Compklr\Desktop test.txt C:\Users\Compklr\Desktop\CUsersCompklrDesktop
pause
I'm simply trying to move a text file from my desktop to a folder on my desktop.
I fixed it, I figured the error was the spaces
Code: Select all
move C:\Users\Compklr\Desktop\test.txt "c:\Program Files"
pause
Now I am denied access though, I'm on the Administrator account too.
Edit:
I then ran it as an administrator and it worked, I'm now curious is there any way around requiring to run as an administrator?
Last edited by MLGsuperGame414 on 14 Jul 2013 11:48, edited 2 times in total.
Re: Installation
I assume there is missing a backslash prior to test.txt.
penpen
penpen
-
- Posts: 54
- Joined: 10 Nov 2011 20:40
Re: Installation
Alrighty my last problem is this
I moving a file from my desktop to program files, yet I cant get my file to let the user know whether or not the file is now in the program files dir, or not. It always just says its not there.
Code: Select all
@echo off
CLS
move C:\Users\%USERNAME%\Desktop\test.txt "C:\Users\%USERNAME%\Program Files"
set empty=Y
for /F %%G in ('dir /b C:\Program Files\test.txt') do set empty=N
If "%empty%"=="N" echo File is there
if "%empty%"=="Y" echo File is not there
Pause
I moving a file from my desktop to program files, yet I cant get my file to let the user know whether or not the file is now in the program files dir, or not. It always just says its not there.
Re: Installation
Obviously not.MLGsuperGame414 wrote:Edit:
I then ran it as an administrator and it worked, I'm now curious is there any way around requiring to run as an administrator?
I assume you are using the wrong directory, either when using the move command, or within the for loop.MLGsuperGame414 wrote:Code: Select all
@echo off
CLS
move C:\Users\%USERNAME%\Desktop\test.txt "C:\Users\%USERNAME%\Program Files"
set empty=Y
for /F %%G in ('dir /b C:\Program Files\test.txt') do set empty=N
If "%empty%"=="N" echo File is there
if "%empty%"=="Y" echo File is not there
Pause
I moving a file from my desktop to program files, yet I cant get my file to let the user know whether or not the file is now in the program files dir, or not. It always just says its not there.
penpen
Re: Installation
MLGsuperGame414 wrote:Alrighty my last problem is thisCode: Select all
@echo off
CLS
move C:\Users\%USERNAME%\Desktop\test.txt "C:\Users\%USERNAME%\Program Files"
set empty=Y
for /F %%G in ('dir /b C:\Program Files\test.txt') do set empty=N
If "%empty%"=="N" echo File is there
if "%empty%"=="Y" echo File is not there
Pause
I moving a file from my desktop to program files, yet I cant get my file to let the user know whether or not the file is now in the program files dir, or not. It always just says its not there.
Replace this
Code: Select all
set empty=Y
for /F %%G in ('dir /b C:\Program Files\test.txt') do set empty=N
If "%empty%"=="N" echo File is there
if "%empty%"=="Y" echo File is not there
Pause
with this:
Code: Select all
if exist "C:\Program Files\test.txt" (echo File is there) else (echo File is not there)
Pause
c:\program files is a restricted location in modern windows - pick somewhere else.
-
- Posts: 54
- Joined: 10 Nov 2011 20:40
Re: Installation
Would any dir in Program Files work?