Save below in a test.bat
and It’ll work for you:
@echo off net use Z: \\server\SharedFolderName password /user:domain\Username /persistent:yes
/persistent:yes
flag will tell the computer to automatically reconnect this share on logon. Otherwise, you need to run the script again during each boot to map the drive.
For Example:
net use Z: \\WindowsServer123\g$ P@ssw0rd /user:Mynetdomain\Sysadmin /persistent:yes
Related Posts:
- What does “@” mean in Windows batch scripts
- Create an empty file on the commandline in windows (like the linux touch command)
- How to solve “The directory is not empty” error when running rmdir command in a batch script?
- How do I create a Batch file to change an exe installer to Win XP SP3 compatibility mode and launch installer
- Batch script loop
- How to run PowerShell in CMD
- xcopy returns error “Invalid number of parameters” when exclude parameter is set
- While loop in batch
- Curl not recognized as an internal or external command, operable program or batch file
- Redirecting Output from within Batch file
- How to send a simple email from a Windows batch file?
- How can I run a program from a batch file without leaving the console open after the program starts?
- What does /p mean in set /p?
- False ‘Sharing Violation’ Xcopy error message
- batch file from scheduled task returns code 2147942401
- How does the echo command works in batch programming
- CALL command vs. START with /WAIT option
- Need auto-restart script in batch for minecraft server
- How to use random in BATCH script?
- Windows batch – concatenate multiple text files into one
- How to set commands output as a variable in a batch file
- Batch command for ImageMagick to convert all files in a directory and sub-directories on windows
- Best practice for exiting batch file?
- how to empty recyclebin through command prompt?
- Why is “MINGW64” appearing on my Git bash?
- Using %PROGRAMFILES(x86)% on Windows OS 32bit
- how to get program files x86 env variable?
- What are good grep tools for Windows? [closed]
- Can’t connect to MySQL server on ‘localhost’ (10061) after Installation
- ow can I find where Python is installed on Windows?
- Setting Windows PowerShell environment variables
- Can’t connect to MySQL server on ‘localhost’ (10061) after Installation
- Why is Windows 32-bit called Windows x86 and not Windows x32?
- How to run a PowerShell script
- How can I open a cmd window in a specific location?
- Python 3.2 Unable to import urllib2 (ImportError: No module named urllib2)
- what is a “dump file” in windows task manager?
- Python 3.2 Unable to import urllib2 (ImportError: No module named urllib2)
- How do I run Redis on Windows?
- Need to navigate to a folder in command prompt
- Using putty to scp from windows to Linux
- Difference between xcopy and robocopy
- ‘npm’ is not recognized as internal or external command, operable program or batch file
- how to open an mp3 file with c
- Bat file to run a .exe at the command prompt
- Command Prompt “Net View System Error 6118”
- git clone: Authentication failed for
- How to compile LEX/YACC files on Windows?
- Command ‘ls’ not working in command prompt
- openssh windows bad owner or permissions
- What is the default password for Postgres
- “X does not name a type” error in C++
- how to edit or see the source code for dll files
- PermissionError: [WinError 5] Access is denied python using moviepy to write gif
- Text editor to open big (giant, huge, large) text files
- PermissionError: [WinError 5] Access is denied python using moviepy to write gif
- Xampp MySQL not starting – “Attempting to start MySQL service…”
- Visual C++ executable and missing MSVCR100d.dll
- Python 3.2 Unable to import urllib2 (ImportError: No module named urllib2)
- What is the ASCII Code of ½?
- Docker for Windows error: “Hardware assisted virtualization and data execution protection must be enabled in the BIOS”
- Why Local Users and Groups is missing in Computer Management on Windows 10 Home?
- How to force `findstr` to ignore `Cannot open` returns
- Npm Please try using this command again as root/administrator
- Choosing a Windows automation scripting language. AutoIt vs Autohotkey
- “python” not recognized as a command
- sudo command not found on Cygwin
- What is Windows Fabric and how to host services in it?
- starting R: Error: ‘\U’ used without hex digits in character string starting “”C:\U”
- npm ERR! No git binary found in $PATH
- SVN admin management GUI tool
- ‘openssl’ is not recognized as internal or external command
- docker error : the input device is not a TTY. If you are using mintty, try prefixing the command with ‘winpty’
- cat not recognised as an internal or external command
- How to grant permission to users for a directory using command line in Windows?
- Making a countdown timer in C++
- Is there a Pattern Matching Utility like GREP in Windows?
- How do you clear the console screen in C?
- How can I do GUI programming in C?
- What is %0|%0 and how does it work?
- Why do fonts appear jagged in Chrome?
- Visual Studio compiles but the exe isn’t there
- In Windows cmd, how do I prompt for user input and use the result in another command?
- Aliases in Windows command prompt
- Docker hv-sock proxy (vsudd) is not reachable windows
- how to open Jupyter notebook in chrome on windows
- Calling dir in cmd prints out: “Volume in drive C has no label.”
- Difference between $? and $LastExitCode in PowerShell
- How to use/install GNU binutils (objdump)
- In which cases does program exit with 0x40010004 code?
- Sublime Text from Command Line
- Where do you usually have your DirectX SDK folder?
- What is the difference between \ and \\ in file path
- Using %PROGRAMFILES(x86)% on Windows OS 32bit
- “NODE_ENV” is not recognized as an internal or external command, operable command or batch file
- HyperV is not available on Home editions
- What’s a good (free) visual merge tool for Git? (on windows)
- php exec() is not executing the command
- You require permission from “Myself” to delete folder – how to fix
- How to sleep in a batch file?