Ed_P Posted March 24, 2022 Share Posted March 24, 2022 I have used this script on several Windows notebooks, the previous one Windows 10. I now have a new notebook which is also Windows 10 and the script doesn't work. The script allows me to use my old U3 USB drive on my notebook and to share it with the desktop machine upstairs and to read and copy files between them. echo off&Title ShareMyU3Drv&Color 1F&MODE CON LINES=100 COLS=35 @if %1! == ! goto ShareMyU3 @goto RemoteQ :ShareMyU3 @title Share My U3 drive&MODE CON: COLS=64 LINES=7&COLOR 1F @echo on @set SHR="Eds USB Drv" ::if not exist \\Dell_D400\%SHR%\*.* goto ShareIt ::if not exist \\EDS-ACERNB\%SHR%\*.* goto ShareIt @if not exist \\EDS-DELL\%SHR%\*.* goto ShareIt NET SHARE %SHR% /DELETE :ShareIt if "%cd%" equ "C:\Windows\system32" ( echo Being run as Admin cd Q:\ goto ShareQ ) if "%cd%" neq "Q:\" ( echo. echo. echo cd="%cd%" echo ** This cmd must be run from the Q: drive. ** echo. @ pause > nul exit ) :ShareQ @cd .. NET SHARE %SHR%=%cd% /USERS:1 /GRANT:Everyone,CHANGE echo %errorlevel% @if errorlevel 2 cls @if errorlevel 1 cls&NET SHARE %SHR%=%cd% /USERS:1 @echo Press Enter to unshare %SHR% @pause > nul NET SHARE %SHR% /DELETE @if errorlevel 2 pause > nul ::if errorlevel 2 echo %SHR% not freed&pause > nul @cd \documents @exit :RemoteQ @title Quicken remote USB drive access&MODE CON: COLS=42 LINES=6 @echo off color 1f if exist \\DELL_D400\"Eds USB Drv" subst Q: \\DELL_D400\"Eds USB Drv" if exist \\EDS-ACERNB\"Eds USB Drv" subst Q: \\EDS-ACERNB\"Eds USB Drv" if exist \\EDS-DELL\"Eds USB Drv" subst Q: \\EDS-DELL\"Eds USB Drv" if not exist Q:\*.* pause > nul&exit echo. echo Q: drive assigned echo. echo Press Enter to release the Q: drive. pause > nul subst Q: /d exit The script has to be run as Admin and with the new notebook doing that causes the run location to change from q:\ to c:\windows\system32. So I added a test to the script to account for that but the test fails and I get this error msg: operable program or batch file. cd="C:\Windows\system32" ** This cmd must be run from the Q: drive. ** And the MODE LINES and COLS commands at the top of the script aren't working on the new system either. While I would like to figure out what has changed and why my main priority is getting the script to work again. What am I doing wrong??? Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.