0

hey everyone im a bit of a noob with programing because im only 16 so can you please explain your reply simply.

im trying to make a batch file that asks for a password and opens a file and if the password is wrong displays a message i know how to do this with a .vbs file (like the one you type in notepad not like visual basic 6). i will put the .vbs code up and could some one please show me how to put into cmd lanugage

x = inputbox ("type in password")

if x = "mypassword" then
set x = createobject("wscript.shell")
x.run "file i want to open"

else

z = msgbox("wrong",0,"Error")

end if

Edited by billly: n/a

3
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by sandeepparekh9
0

use this in batch file

@echo off
set /p pass= What is Password?

if %pass% ==yourpassword start c:\passwordprotected.txt

Edited by sandeepparekh9: n/a

0

small problem im trying to use the %userprofile% command for the file location ( %userprofile%\Desktop\Folder) but it wont open the full location it just opens the %userprofile% part what am I doing wrong???

Edited by billly: n/a

0

Check out this thread about "UserProfile".

You can also use this to get a user's Desktop directory.

Dim sCoolDesktopDirectory As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
        MsgBox(sCoolDesktopDirectory)
0

%USERPROFILE%\Desktop\myfile.txt

this works fine to open a file but to open a folder use

explorer.exe %USERPROFILE%\Desktop\Folder

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.