Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
NaorG

Drive mapping BAT file dont work

Recommended Posts

Posted · Original PosterOP

I just reinstall windows as i do every year, and it used to work before but now it dosent...

 

If i  use the  "map network drive" in "This PC" it works. But some times, after windows update, my pc cant find them.

So i need to delete and remap them. it's tedious and annoying.

So i decided to bat this on startup

After executing the following code, I cant see the drives in "This PC" or in the CMD

but!! if i run the same code on CMD with no bat it works... T-T
any help?

@echo off

title MyCloud Network Connection



net use Y: /delete
net use Z: /delete



cmdkey /add:*******  /user:******** /pass:*********
net use Y: \\MYCLOUD\Public
net use Z: \\MYCLOUD\School

 

Link to post
Share on other sites

@NaorG Have you tried putting the username/password in the "net use" command?

net use Y: \\MYCLOUD\Public [**password**] /user:[**user**] /savecred /persistent:yes
net use Z: \\MYCLOUD\School [**password**] /user:[**user**] /savecred /persistent:yes

Also, if you don't turn echo off, it may show you any errors that "net use" is running into.


Main System (Byarlant): Ryzen 5 1600X | Asus B350-F Strix | Corsair H80i V2 | 16GB G.Skill DDR4 3200MHz CAS-14 | Reference Nvidia GTX 770 2GB | Samsung 960 PRO 512GB / Samsung 970 EVO 500GB / Seagate 7200RPM 3TB | Corsair CX650M | Mellanox ConnectX-2 10G NIC | Anidees AI-07BW Case | Dell U3415W Monitor | Microsoft Modern Keyboard

 

FreeNAS Server (Veda): Core i3-4170 | Supermicro X10SLL-F | Corsair H60 | 32GB Micron DDR3L ECC 1600MHz | 4x 10TB WD Whites / 1x Samsung PM961 128GB / 1x Kingston SSD 16GB | Corsair CX430M | Mellanox ConnectX-2 10G NIC | LSI 9207-8i LBA | Fractal Design Node 804 Case (side panels swapped to show off drives)

 

Media Center (Jesta): Core i7-2600 | Asus H77M-PRO | Stock Cooler | 8GB No-name DDR3 | EVGA GTX 750Ti SC | Sandisk UltraII SSD 64GB / Samsung 850 EVO 250GB | Corsair CX450M | Hauppauge ImpactVCB-PCIe | Asus Xonar Sound | LG UH12NS30 BD-ROM | Silverstone Sugo SG-11 Case

 

Laptop (Rozen-Zulu): Sony VAIO VPCF13WFX | Core i7-740QM | 8GB Patriot DDR3 | GT 425M | Kingston 120GB SSD | Blu-ray Drive | (Still my favorite typing keyboard)


Tablet (ReGZ): Asus T102HA | Samsung EVO+ microSD 128GB

 

Testbed/Old Desktop (Kshatriya): Xeon X5470 @ 4.0GHz | ZALMAN CNPS9500 | Gigabyte EP45-UD3L | 8GB Nanya DDR2 400MHz | XFX HD6870 DD | OCZ Vertex 3 Max-IOPS 120GB | Corsair CX430M (?) | HooToo USB 3.0 PCIe Card | NZXT H230 Case

 

Camera: Sony A7II (w/ Meike Grip) | Sony SEL24240 | Sony SEL2870 | Sony SEL55F18F | PNY Elite Perfomance SDXC cards

Link to post
Share on other sites

Probably not related but if you run Net use too quick after a boot sequence the network connection might not be up and often will fail. You can, with task scheduler delay the batch for couple seconds i.e 30 seconds. Which allow all windows services and connection to be properly up and running. If that also fail like on of my old office setup, i had relied on using a VBS script that open each folder one by one to force a reconnect using the known network credentials.

Link to post
Share on other sites
Posted · Original PosterOP

 

@AbydosOne

thay both have the same pass and user name

im a csharp main that was a script i learned alone 
how can i turn echo off?

@Franck
how can i delay  the batch?

 

Link to post
Share on other sites
1 hour ago, NaorG said:

 

@AbydosOne

thay both have the same pass and user name

im a csharp main that was a script i learned alone 
how can i turn echo off?

@Franck
how can i delay  the batch?

 

open the task scheduler

image.png.4d8f7ddbb01b7bbed34f6dc11528eccb.png

 

Choose task scheduler library and click create task

image.png.0615fd1e724474ae0515597aed866cea.png

 

give the task a name in the first tab then head to the trigger, click new and choose "at logon" and select all user and the amount of minutes to delay

 

image.png.a7bcd6e989ba99bf0a9c8b79449b8d7e.png

 

Then go in the action tab and click new, select start program and type in the path to the batch file

image.png.da8b531f460bf387fd634e07d70b6312.png

 

Link to post
Share on other sites
1 hour ago, NaorG said:

how can i turn echo off?

@echo on

... or just delete that line.

1 hour ago, NaorG said:

thay both have the same pass and user name

That's fine. Just pass the credentials to both.


Main System (Byarlant): Ryzen 5 1600X | Asus B350-F Strix | Corsair H80i V2 | 16GB G.Skill DDR4 3200MHz CAS-14 | Reference Nvidia GTX 770 2GB | Samsung 960 PRO 512GB / Samsung 970 EVO 500GB / Seagate 7200RPM 3TB | Corsair CX650M | Mellanox ConnectX-2 10G NIC | Anidees AI-07BW Case | Dell U3415W Monitor | Microsoft Modern Keyboard

 

FreeNAS Server (Veda): Core i3-4170 | Supermicro X10SLL-F | Corsair H60 | 32GB Micron DDR3L ECC 1600MHz | 4x 10TB WD Whites / 1x Samsung PM961 128GB / 1x Kingston SSD 16GB | Corsair CX430M | Mellanox ConnectX-2 10G NIC | LSI 9207-8i LBA | Fractal Design Node 804 Case (side panels swapped to show off drives)

 

Media Center (Jesta): Core i7-2600 | Asus H77M-PRO | Stock Cooler | 8GB No-name DDR3 | EVGA GTX 750Ti SC | Sandisk UltraII SSD 64GB / Samsung 850 EVO 250GB | Corsair CX450M | Hauppauge ImpactVCB-PCIe | Asus Xonar Sound | LG UH12NS30 BD-ROM | Silverstone Sugo SG-11 Case

 

Laptop (Rozen-Zulu): Sony VAIO VPCF13WFX | Core i7-740QM | 8GB Patriot DDR3 | GT 425M | Kingston 120GB SSD | Blu-ray Drive | (Still my favorite typing keyboard)


Tablet (ReGZ): Asus T102HA | Samsung EVO+ microSD 128GB

 

Testbed/Old Desktop (Kshatriya): Xeon X5470 @ 4.0GHz | ZALMAN CNPS9500 | Gigabyte EP45-UD3L | 8GB Nanya DDR2 400MHz | XFX HD6870 DD | OCZ Vertex 3 Max-IOPS 120GB | Corsair CX430M (?) | HooToo USB 3.0 PCIe Card | NZXT H230 Case

 

Camera: Sony A7II (w/ Meike Grip) | Sony SEL24240 | Sony SEL2870 | Sony SEL55F18F | PNY Elite Perfomance SDXC cards

Link to post
Share on other sites
19 minutes ago, NaorG said:

@Franck 
can i do it in a script?

in the program script field you just put your path to the batch that does your mapping. I always used it to run .bat it's much easier but the title of the field seems to allow for script.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×