|
Answer» Hi
is it possible to use the "net use" command with a "%1"
Ex:
ehco ENTER your server name echo server name = %1 net use Z: \\%1 /Persitent:NO
thanks for your helpI tried a different approche but with no luck...
Code: [Select]echo enter your Server Name or IP adress echo %1 1:Name echo %1 2:IP set choice= set /p choice= if not '%choice%'=='' set choice=%choice:~0,1% if '%choice%'=='1' goto NAME if '%choice%'=='2' goto IP
:NAME net use z: \\%1 /PERSISTENT:NO
:IP net use z: \\%1 /PERSISTENT:NO The problem is that i'm not promt to enter any informations....
I'd like the %1 the be the info the user enter...It is not clear what you think "%1" is for. tried ANOTHER thing that almost do what I want it....
Code: [Select]:START set /p nameorip="enter your Server Name or IP adress" echo. echo %nameorip% if '%nameorip%'=='' GOTO errorlevel1 else ( GOTO NAMEORIP)
:NAMEORIP net use z: \\%nameorip% /PERSISTENT:NO
:errorlevel1 echo you must input a string. echo. pause exit the problem here is : it does wait for me to input a string, but at the end of the line of ip adress. so I take it that it does not reconize my string so it goes to the errorlevel....
Code: [Select]:START set /p nameorip="enter your Server Name or IP adress" echo. echo %nameorip% if '%nameorip%'=='' GOTO errorlevel1 net use z: \\%nameorip% /PERSISTENT:NO goto end :errorlevel1 echo you must input a string. echo. pause :end exithanks for the reply ! it's almost there !!
here's what "net use"'s returning me :
System error 53 has occurred.
The network path was not FOUND.
also is there a WAY to input the string onto a different line then the first one ?
found what I was looking for on that...
but there is still the option I'm not too convinced about....
Quote from: metal_man77 on December 21, 2010, 01:21:58 PM System error 53 has occurred.
The network path was not found.
1. Try a CAPITAL letter for the drive letter Z 2. Do not put a space after the Z
Quotebut there is still the option I'm not too convinced about....
What does this mean?
Quote from: Salmon Trout on December 21, 2010, 01:33:56 PM1. Try a CAPITAL letter for the drive letter Z 2. Do not put a space after the Z
give me the system error 67
Quote from: Salmon Trout on December 21, 2010, 01:33:56 PM
Quote from: metal_man77 on December 21, 2010, 01:21:58 PMbut there is still the option I'm not too convinced about....
What does this mean?
I meant the net use option... with the % attibute....
UPDATE : I found what was causing the error... I cannot SIMPLY have a share of a computer, I must have a share of a folder on that computer !
UPDATE2 : IT'S ALIVE !! It works as I want it to work !! thanks a bunch ^^
Quote2. Do not put a space after the Z
This was wrong.
Quote from: Salmon Trout on December 21, 2010, 02:56:43 PM
Quote from: Salmon Trout on December 21, 2010, 01:33:56 PM2. Do not put a space after the Z
This was wrong.
No.. it was how I was making use of the ne use command....
I found out that you cannot simply map à drive to a computer, you MUST map it to à shared folder of that computer !!
Ex.: [WRONG] net use X: \\computer1 [ RIGHT ] net use x: \\computer1\folder1
|