Microsoft DOS

13K

Solutions

12K

Contributors

Microsoft Disk Operating System (MS-DOS) was an operating system for x86-based personal computers, and traces of it are still found in the Windows operating system. DOS is still used in some embedded systems and for certain legacy 16-bit networks.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hello Experts,

I need a help I've a batch script for folder locking, in this script I've set a password for folder access after that I convert this batch to exe & give it to users.
Now user wants to create own password & after creating the password once user put password for folder access it should not be appear it should be in form in dot or blank.
Most important thing i want set a default password in case users forget password in that case admin should open that folder from default password, also main folder, sub folder & files which is store in Vault folder should not be find if anyone try to find using windows search.

Script:-

cls
@echo off
mode 50, 10
title   ~Safty Vault~

echo.
(SET OUT=3F)

color %OUT%

if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Vault goto MDLOCKER
:CONFIRM
echo Are you sure you want to lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Vault "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to unlock folder
set/p "pass=>"
if NOT %pass%== password goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Vault
echo Folder Unlocked successfully
0
Exploring ASP.NET Core: Fundamentals
LVL 12
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

Hi Experts,

I have this question after resolving the following

https://www.experts-exchange.com/questions/29109077/How-to-concatenate-all-files-from-one-folder-into-one-ignoring-headers.html#a42623555

How can I modify the command to

1- Ignore all headers
2- include only files created in specific date range
3- include only files with specific names, like "*PatSched* and "*PatChanges*"

Thanks in advance.
0
Hello,

This is a follow-up to another thread located here:

Create an executable file to open a non-executable file

In that thread, expert Joe Winograd provided a solution which involves creating an AutoHotkey (ahk) "Run" command (which I know how to do) then compiling the resulting .ahk file to create an .exe file. That was a great solution and I'm glad to now know how to do that. However, since closing the previous thread, I've realized that that solution is not practical for the specific purpose* that prompted my question.

As a result, I'm back to my original question which is:

How do you directly create an executable file (.exe or .cmd) to open a non-executable file (.xlsm, .txt, .ahk, etc)?

In the previous thread, expert tuvi suggested putting the following in a .cmd file:

start C:\Users\UserName\FolderName\FileName.xlsm

Open in new window

Unfortunately, while I know how to place a command in the cmd/prompt/DOS window (not sure what it's called), I do not know how to create a .cmd or .exe file. I tried simply pasting the above line in a Notepad window then saving it, first with a .cmd extension and then with an .exe extension but neither of those worked.

It seems like something I should know how to do but that's why I'm happy all of you great experts are available to answer questions. :)

Thanks…
0
Chemo has taken a lot from me. I am having problem with a batch file and have gone back to square 1 to test simple things.

@ECHO OFF
IF EXIST %1 GOTO ITEXIST
ECHO %%1 DID NOT EXIST
GOTO EXIT
:ITEXIST
ECHO %%1 DID EXIST
:EXIT
ECHO ON

Why am I getting a syntax error?
1
Have a user that started saving long file names and folders creating problems on a 2012 Server. File path has exceeded 280+ in length luckily there are only 5 folders affected. Problem is I created a virtual directory to the folder using Subst command, however I get this error when I try to rename it.
subst error
I tried Subst in administrator mode but the drive doesn't show, a known issue.
I tried without administrator mode and the mapped drive shows however I get the above error.
Downloaded the gui interface get the same error above.
0
I have one folder "destination" where I have files and their time stamps (created, modified) I would like to preserve when I overwrite a few of those files with updated version of those files.

example

Destination Folder 
File.mp4- Created 01/01/01 (size 500mb)

Source Folder 
File.nmp4 - Created 12/12/12 (size 4.00gb)

Open in new window

I overwrite the file in the Destination folder with the new updated version from the Source Folder but keeping the original file in the destination folder timestamps

End Result (new overwrite file in the destination folder with original file timestamps)

Destination Folder
File.mp4 - Created 01/01/01 (size 4.00gb)

Open in new window


I have written a batch file to move the file as so

 
robocopy "Source" "Destination" /E

Open in new window


and this handles my overwrites and moving of my files perfectly, but I haven't found a way to preserves timestamps. I am looking for command-line so I can implement it in a batch file. Any help will be appreciated. I been reading flags for robocopy etc but maybe I'm reading it wrong or something but I haven't figured it out yet.
1
Hello,

How do you create an executable file to open a non-executable file?

I just began using a Corsair K95 RGB keyboard (which includes 18 programmable G-keys) along with its software (CorsairUtilityEngineSetup_2.24.50_release). While assigning macros to the G-keys, I discovered that while the software does allow you to run an executable file (*.exe *.bat *.cmd), there is no option to open a simple non-executable file (eg .txt, .xls, .ahk, .png, etc).

That seemed a bit odd to me but it was confirmed by Corsair tech support so during the conversation I asked about possible workarounds and the response was that I could create an .exe or .cmd file to open the desired non-executable file.

So for example, suppose you want to open the following Excel file:

    C:\Users\UserName\FolderName\FileName.xlsm

How would you create an .exe or .cmd file to do that?

Thanks
0
Hi Experts,
I have the following batch file
@echo off
setlocal

set  tm=%time: =0%
set  tm=%tm::=%
set dt=%date:~10,4%%date:~4,2%%date:~7,2%

copy  C:\Users\bfuchs\Dropbox\Caspio\CaspioTables.zip  h:\CaspioTablesDaily\CaspioTables%dt%%tm:~0,4%.zip

copy  F:\Data\SkilledNursingVisitNotestbl.mdb  h:\AccessTablesDaily\Skilled_Nursing_Tables%dt%%tm:~0,4%.mdb

Open in new window


Would like to have for the second file (the access file), to zip it into the destination, instead of just copying.

How can I accomplish that?

fyi- I have windows 7.

Thanks in advance.
0
Hello Experts,

I am trying to run as administrator a .bat file on a Windows 10 virtual machine remotely via VirtualBox's command line interface. I am controlling the Windows 10 virtual machine via a Linux headless server.

Currently I am using the command:

vboxmanage guestcontrol "win10clean" exec --image "C:/Temp/run.bat" --username localadmin --password *** --verbose --wait-stdout

Output:

Opening guest session as user 'localadmin' ...
Waiting for guest session to start ...
Guest session (ID 13) has been started
Starting guest process ...
Process 'C:/Temp/run.bat' (PID 4592) started

C:\WINDOWS\system32>REG ADD HKLM\Software\Microsoft\Windows\currentversion\explorer\advanced /v Start_PowerButtonAction /t REG_DWORD /d 2 Process terminated
Exit code=1 (Status=500 [successfully terminated])
Closing guest session ...

The VM name is win10clean
The .bat file is called run.bat and is stored on the VM under the path C:/Temp/
The run.bat file is suppose to update a registry value which is why the command must be run as administrator. However the registry value says the same.
1
Hi Experts,

We have windows server 2008 along with multipal users they have only remote desktop rights & i dont want assign administrator rights,

but a there is a software which need administrator rights (run as administrator) permission to execute from users, we had manage till startup time manually to run as a administrator with password but now there is more than 50 users that's why i can't manage manually.

I need a batch file which have store administrator password, I'll paste that batch to every user Desktop & locate the software path to in batch file run as administrator.



Path Example :-
for user1
D:/user1/Gm_4.1.1.1_05082018_PAN/EnhanceT.ext

for user2
D:/user2/Gm_4.1.1.1_05082018_PAN/EnhanceT.ext

for user3
D:/user3/NEW_4.1.1.1_12082018_PAN_A/EnhanceT.ext

for user4
D:/user3/Gm_4.1.1.1_05082018_PAN/EnhanceT.ext

for user5
D:/user5/Gm_4.1.1.1_05082018_PAN_5/EnhanceT.ext

for user6
D:/user5/Gm_4.1.1.1_05082018_PAN_6/EnhanceT.ext
0
Angular Fundamentals
LVL 12
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

Hi
I need to rename some files

This works if I cd to the directory first

cd \s z:\Path\with\files\in
ren *.jpeg *.jpg

Open in new window



How do I write a simple bat file that takes the parent folder as a parameter and recursively  renames the files skipping over if the files exist

so if a folder had both MyCat.jpeg and mycat.jpg  it won't over right mycat.jpg (Windows file names are not case sensitive) and won't prompt
0
Hi,

Please let me know how to add SharePoint login credentials in below code.

@echo off
setlocal

echo Start Copy

set SOURCE_DIR=C:\Users\xxxx1\Desktop\kk1
set DEST_DIRS=C:\Users\xxxx1\AppData\Roaming\Microsoft\Windows\Network Shortcuts\SharePoint
set FILENAMES_TO_COPY="Report.xlsx", "Report Full.xlsx"

pushd "%SOURCE_DIR%"

for %%F in (%FILENAMES_TO_COPY%) do (

    for %%D in (%DEST_DIRS%) do (
        echo file "%%~F" to "%%~D"
        xcopy /Y "%%~F" "%%~D"
    )

)

popd

echo. Done.
exit /b

Really appreciate any suggestions on this.
K
0
Hi

I need to upload output files into multiple destination folder, Can anyone modify below code accordingly please.

@ECHO OFF
ECHO Start Copy

set SOURCE_DIR=C:\Users\xxxx1\Desktop\kk1
set DEST_DIR=C:\Users\xxxx1\AppData\Roaming\Microsoft\Windows\Network Shortcuts\SharePoint
set FILENAMES_TO_COPY="Report.xlsx", "LondonReport Full.xlsx"

pushd "%SOURCE_DIR%"
for %%F IN (%FILENAMES_TO_COPY%) do (
    echo file "%%~F"
    xcopy /Y "%%~F" "%DEST_DIR%"
)
popd
ECHO. done
exit /b

Thanks
K
0
I am trying to deploy local windows firewall rules to several separate Windows 7 laptops.  We have Novell NetWare in our environment; hence, using Group Policy from a WIndows Domain to propagation to the devices, is not a n option (unfortunately).

I have discovered that if one executes a batch file, with the command:

netsh advfirewall firewall add rule name="NetScaler Gateway Plug-in" dir=in action=allow profile=public program="C:\Program Files\Citrix\Secure Access Client\nsload.exe" protocol=TCP enable=yes

Open in new window


that works really well ( https://support.microsoft.com/en-us/help/947709/how-to-use-the-netsh-advfirewall-firewall-context-instead-of-the-netsh ); but, the problem is that when executing the above command you need to run the command prompt as an administrator.

DOS_1
As you can see if the user does not have admin privileges or does not know the administrator password, then the only other thing I can think is to create 2 batch files and manually copy the files to the user's laptop.  1 file will have the  'runas' command to use the local administrator user account and then to trigger another batch file with the changes:

runas /user:administrator C:\data\mybatchfile.bat

Open in new window


https://www.windows-commandline.com/windows-runas-command-prompt/

So the batch file: mybatchfile.bat will actually have the code that adds the firewall rule(s):

netsh advfirewall firewall add rule name="NetScaler Gateway Plug-in" dir=in action=allow profile=public program="C:\Program Files\Citrix\Secure Access Client\nsload.exe" protocol=TCP enable=yes

Open in new window


Question1:  Is there a way to streamline the deployment approach because our users will require these local windows firewall rules and these users are not administrators on their company laptops.  

Question2:  Is there a way to elevate permissions for a batch file as the script begins executing?  So you will not be prompted for a password?
0
Hi

I have some reports (MS excel Spreadsheets) on my folder on C drive. I have created a module in MS Access 2013 database. This module can be called using AutoExec macro. Basically I have created some scripts which will run a query and export the result into different excel files and then do the formatting. I need to transfer those excel files into SharePoint on daily basis. SharePoint is password protected. I am trying to automate the process. I use windows 7 OS, Office 2013. I am looking for a vba code/scrip or MS DOS/batch to do this work for me.

On SharePoint, there are some files already exist. I don't want to delete those files while I run script to transfer my reports into SharePoint.

Any support on this would be greatly appreciated.

Thanks
K
0
Hello Experts,

we have backup in e:\data\
e.g.
TERMSCLE31_07_2018_04_12.zip
SMECLE31_07_2018_04_18.zip
TERMSCLE01_08_2018_11_00.zip
SMECLE01_08_2018_11_05.zip
TERMSCLE02_08_2018_02_39.zip
SMECLE02_08_2018_02_45.zip
TERMSCLE03_08_2018_05_55.zip
SMECLE03_08_2018_05_56.zip

I want take backup on daily base from e:\data\<current date .zip> to two drives

e.g.
g:\ace\<create current date folder>\

k:\rule\<create current date folder>\

Please suggest this process how to done from batch script, after complete this task log (.txt or .csv) should be generated ?
0
Hi Folks,

is there a command or a way that will decipher what GPOs are being applied to a GroupMember ?
0
Dear Experts, is there any CMD or Powershell scripts to check domains' expiration dates?

Many thanks!
0
Transpose () filenames from DIR & list them to txt or excel file either via CMD or Macro
The DIR contains sub folders, with files majorly of .tiff extension.

There is a logic while listing them and transpose.
Lets say there are 10 files in a sub folder. We manually rename a particular image in the example"0001_0001.tif" with additional "0001" which reflects as"0001_0001_0001.tif".


0001_0001_0001.tif
0002_0002.tif
0003_0001.tif
0004_0002.tif
0006_0001_0001.tif
0007_0005.tif
0007_0009.tif
0008_0010.tif

Requirement: The file names should be transposed and listed as per the breaker provided ie additional "0001.tif" . The output will look like.

DIR / Subfolder/0001_0001_0001.tif  0002_0002.tif 0003_0001.tif 0004_0002.tif

Thanks!
0
Become a Certified Penetration Testing Engineer
LVL 12
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

I am attempting to write an automated uninstall string, same app, multiple versions. I would have preferred to do this via PowerShell but apparently their servers are so old only some of them support it. So I have found a command line way to find the uninstall strings from the registry, but I am not sure how to pass the string to an execute inside of a batch.

reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /s /f "OpenSSL" | findstr /B ".*UninstallString"
reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" /s /f "OpenSSL" | findstr /B ".*UninstallString"
0
When I run this statement, I get an error that says "%%G was unexpected at this time":
for /F "tokens=2 delims==" %%G in ('WMIC /NODE:"myserver" Service WHERE "Name = 'myservice'" GET State/value') do set CURSVCSTATE=%%G

But, when I run just the WMIC statement, it works fine:
WMIC /NODE:"myserver" Service WHERE "Name = 'myservice'" GET State/value

I'm pretty sure it has to do with the single quote terminating the WMIC command to early, but I can't figure out how to fix it!
0
I have a windows batch file with echo off that gets user input using the SET /P statement like this:
SET /P UserAnswer=What is your answer?

I am calling this batch file with another batch file (CallerBatch.bat) using the "CALL" command and I'm using the > character to redirect the output to a file, like this:
CALL "MyBatch.bat" >MyOutput.txt

The problem is that when I run CallerBatch.bat, I never see the "What is your answer?" appear, even though the system is waiting for the user input.

How can I set it up so that this can happen?
0
Hi,
I want to ensure all output of dir, would go into t3 file. What to adjust below?
dir c:\peter\*.*/s >> c:\ed\t3.txt
dir c:\may\*.*/s >> c:\ed\t3.txt

Open in new window

0
Can anyone advise me if the script below deletes 30 days after the subfolder amended OR 30 days after it created.

What I need it to do is delete 30 days after the subfolder was created and not 30 days after last opened or amended.

@echo off
set dump_path=S:\DOWNLOADS
set max_days=30
forfiles -p %dump_path% -m *.* -d -%max_days% -c "cmd  /c del /q @path"
forfiles -p %dump_path% -d -%max_days% -c "cmd /c IF @isdir == TRUE rd /S /Q @path"

Open in new window

Thanks
0
Hi Experts,

I have a .bat file that is used to backup data.  I want to include all folders / files on a drive but exclude one folder.  I can't seem to get it to do the exclusion.

Here is the WinZip Command Line.

"C:\Program Files\WINZIP\WZZIP.EXE"  -xd\\PL1\PL1-G-Data\Photos\*.*   "Z:\PATLAPTOP1\PL1-G-Data\%date%\PL1-G PatData All.ZIP" "\\PL1\PL1-G-PatData\*.*"  -r -p

Explanation
- Job is run on the PC where the 'Z:' Drive is located.
- Drive to be zipped is on PC \\PL1.
-  The Drive to be zipped is PL1-G-PatData.
- Folder (with sub folders) that needs to be excluded is PL1-G-Data\Photos

What needs to be done to get it exclude the PL1-G-Data\Photos folder.  Right now there are no errors but it is including the Photos folder?

Note: If using an 'Exclusion Parameter File' is a better way them I ok with it.

Thanks,
Bob C.
0

Microsoft DOS

13K

Solutions

12K

Contributors

Microsoft Disk Operating System (MS-DOS) was an operating system for x86-based personal computers, and traces of it are still found in the Windows operating system. DOS is still used in some embedded systems and for certain legacy 16-bit networks.