user name
Moderator: DosItHelp
Re: user name
Sorry Squashman, I did what you suggested, but to a begginer doesn´t do much sense, I know that I need a lot of maybe basic knowledge, still don´t know what means a lot of symbols like: (%%x), or (tokens=1,2 delims=:), but I believe that this is the porpuse of this board, and as I learn with your help it help others.
Re: user name
Code:
______________________________________________________________________________
This makes a folder call GIGAS, but doesn´t list the amount of gigas on a text inside the gigas folder
_____________________________________________________________________________
When I use these alone it gives me the size of the folders on the desktop, but in a DOS windows.
Code: Select all
@echo off
color 0A
CLS
:MENU
ECHO.
ECHO Desktop C: - 1
ECHO D: - 2
ECHO E: - 3
ECHO F: - 4
ECHO G: - 5
ECHO H: - 6
ECHO I: - 7
ECHO SALIR - 8
ECHO.
set drive=
set /p drive= HOW MANY GIGABYTES USE THE FOLDERS IN EACH PARTITION?
ECHO.
if "%drive%"=="1" (set "drive=%userprofile%\desktop")
)else if "%drive%"=="2" (set "drive=D:"
)else if "%drive%"=="3" (set "drive=E:"
)else if "%drive%"=="4" (set "drive=F:"
)else if "%drive%"=="5" (set "drive=G:"
)else if "%drive%"=="6" (set "drive=H:"
)else if "%drive%"=="7" (set "drive=I:"
)else if "%drive%"=="8" (goto :eof
) else goto :menu
md %drive%\GIGA
if not exist %drive%\GIGA md %drive%\GIGA
for %%x in %drive% do LIST GIGA.TXT >nul 2>nul /-y %drive%\*.%%x %drive%\GIGA
This makes a folder call GIGAS, but doesn´t list the amount of gigas on a text inside the gigas folder
Code: Select all
@echo off &setlocal
set "folder=%userprofile%\Desktop"
for /f "tokens=1,2 delims=: " %%a in ('robocopy "%folder%" "%folder%" /L /S /NJH /BYTES /FP /NC /NDL /NFL /TS /XJ /R:0 /W:0') do if /i "%%a"=="Bytes" set "size=%%b"
echo %size% bytes
pause
When I use these alone it gives me the size of the folders on the desktop, but in a DOS windows.
Last edited by aGerman on 11 Oct 2021 10:36, edited 1 time in total.
Reason: code formatting
Reason: code formatting
Re: user name
Unbalanced parentheses, invalid syntax (missing space space between ) and else, and whatever you think for %%x in %drive% do LIST GIGA.TXT >nul 2>nul /-y %drive%\*.%%x %drive%\GIGA should do).This makes a folder call GIGAS, but doesn´t list the amount of gigas on a text inside the gigas folder
Code: Select all
When I use these alone it gives me the size of the folders on the desktop, but in a DOS windows.
Actually the commands are well-documented and it's not the purpose of this forum to repeat the help messages of the commands and to teach you the basics. In the first place it's your task to read them and learn/look up the syntax.but I believe that this is the porpuse of this board
Run HELP, or <command> /? (with <command> as placeholder for the actual command like SET or FOR), or look it up in the Command Index on DosTips, or in the official Microsoft documentation.
Steffen
Re: user name
thanks aGerman I will look at that index
Re: user name
Hello steffen, I am back and after reading, trying, testing I got two things:
1.- a program that tells me who is the user - to be use on the desktop
2.- a program that you started, that tells me the amount of megas used by the folders on my desktop, I solved converting the bytes to megas and writting the output of the Cmd to a text form and put it inside a folder.
I will post both, as I see that a lot of people asked in other boards how to send the CMD result to a text form.
1.- a program that tells me who is the user - to be use on the desktop
2.- a program that you started, that tells me the amount of megas used by the folders on my desktop, I solved converting the bytes to megas and writting the output of the Cmd to a text form and put it inside a folder.
I will post both, as I see that a lot of people asked in other boards how to send the CMD result to a text form.
Re: user name
Code:
@echo off
color 0A
CLS
ECHO WHAT IS THE USER NAME?
ECHO MACOGA VER.1.0
:MENU
ECHO.
ECHO =================================================================
ECHO this program tells me who is the user
ECHO =================================================================
ECHO.
ECHO Folder on desk - 1
ECHO SALIR - 2
ECHO.
set drive=
set /p drive= You will see a folder with the user name?
ECHO.
if "%drive%"=="1" (set "drive=%username%\"
)else if "%drive%"=="2" (goto :eof
) else goto :menu
md %drive%
@echo off
color 0A
CLS
ECHO WHAT IS THE USER NAME?
ECHO MACOGA VER.1.0
:MENU
ECHO.
ECHO =================================================================
ECHO this program tells me who is the user
ECHO =================================================================
ECHO.
ECHO Folder on desk - 1
ECHO SALIR - 2
ECHO.
set drive=
set /p drive= You will see a folder with the user name?
ECHO.
if "%drive%"=="1" (set "drive=%username%\"
)else if "%drive%"=="2" (goto :eof
) else goto :menu
md %drive%
Re: user name
Code:
@echo off
color 0A
CLS
:MENU
ECHO MACOGA VER 1.0
ECHO Desktop C: - 1
ECHO D: - 2
ECHO E: - 3
ECHO F: - 4
ECHO G: - 5
ECHO H: - 6
ECHO I: - 7
ECHO EXIT - 8
ECHO.
set drive=
set /p drive= HOW MANY GIGABYTES USE THE FOLDERS IN EACH PARTITION?
ECHO.
if "%drive%"=="1" (set "drive=%userprofile%\desktop"
)else if "%drive%"=="2" (set "drive=D:"
)else if "%drive%"=="3" (set "drive=E:"
)else if "%drive%"=="4" (set "drive=F:"
)else if "%drive%"=="5" (set "drive=G:"
)else if "%drive%"=="6" (set "drive=H:"
)else if "%drive%"=="7" (set "drive=I:"
)else if "%drive%"=="8" (goto :eof
) else goto :menu
@echo off
set "folder=%userprofile%\Desktop"
for /f "tokens=1,2 delims=: " %%a in ('robocopy "%folder%" "%folder%" /L /S /NJH /BYTES /FP /NC /NDL /NFL /TS /XJ /R:0 /W:0') do if /i "%%a"=="Bytes" set "size=%%b"
set a=%size%
set b=%11000000%
set /a division=%a%/%b%
set /a result=%size%/%11000000%
md GIGAS
echo %result% MEGABYTES > GIGAS\TOTALDESK1.txt
exit
@echo off
color 0A
CLS
:MENU
ECHO MACOGA VER 1.0
ECHO Desktop C: - 1
ECHO D: - 2
ECHO E: - 3
ECHO F: - 4
ECHO G: - 5
ECHO H: - 6
ECHO I: - 7
ECHO EXIT - 8
ECHO.
set drive=
set /p drive= HOW MANY GIGABYTES USE THE FOLDERS IN EACH PARTITION?
ECHO.
if "%drive%"=="1" (set "drive=%userprofile%\desktop"
)else if "%drive%"=="2" (set "drive=D:"
)else if "%drive%"=="3" (set "drive=E:"
)else if "%drive%"=="4" (set "drive=F:"
)else if "%drive%"=="5" (set "drive=G:"
)else if "%drive%"=="6" (set "drive=H:"
)else if "%drive%"=="7" (set "drive=I:"
)else if "%drive%"=="8" (goto :eof
) else goto :menu
@echo off
set "folder=%userprofile%\Desktop"
for /f "tokens=1,2 delims=: " %%a in ('robocopy "%folder%" "%folder%" /L /S /NJH /BYTES /FP /NC /NDL /NFL /TS /XJ /R:0 /W:0') do if /i "%%a"=="Bytes" set "size=%%b"
set a=%size%
set b=%11000000%
set /a division=%a%/%b%
set /a result=%size%/%11000000%
md GIGAS
echo %result% MEGABYTES > GIGAS\TOTALDESK1.txt
exit
Re: user name
I haven´t tried if the program will work on the other partitions with the commands already listed, or it will need another set of commands.
Re: user name
First of all the variable b is not going to be defined since %11000000% is undefined and second of all why do you need to set a if you already have size? And Why do you need all this?
PS: I think you should stick to 1 post
you can just use
Code: Select all
set /a "result=%size%/11000000"
Re: user name
Hi there AR Coding, the program seems useless, but it help me a lot as I format a lot of computers and clients asked to save the data they have in diferent partitions. I could use the first code, but then I would have to change to the next partition and do the same, also can do the usual select all the folders and look at the properties for the size, but this way I do it automatically, and know right away how much space I need to backup.
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: user name
%11000000% isn't a valid variable, though.
It's %1 (the first argument that the script receives), followed by 1000000, followed by % (which won't do anything since there's only one %)
It's %1 (the first argument that the script receives), followed by 1000000, followed by % (which won't do anything since there's only one %)