Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. To Henry Minute, Original Griff, fly904, stancrm, Computafreak, Guffa, DaveyM69, J4amieC, Tom Deketelaere and Dave Kreskowiak

To Henry Minute, Original Griff, fly904, stancrm, Computafreak, Guffa, DaveyM69, J4amieC, Tom Deketelaere and Dave Kreskowiak

Scheduled Pinned Locked Moved C#
csharpquestiondotnetalgorithmstools
33 Posts 13 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Pete OHanlon

    Normally I don't offer advice to people, but I think you need some help with your people skills here. Over a period of time, you've managed to arouse the suspicions of the regulars in the forum, and you've posted questions that show a lack of understanding about .NET, hence the reason that you have been advised to purchase books on C#. You may want to stop using this identity, create a new user and use that to post in future. Before you do this though, stop and think about why people have been talking like this to you. These guys are good guys, and they give a lot of advice in the forums. It may be time for you to face the fact that the problem isn't them, but you. Yes, English isn't your first language but it's the same for a lot of the others who post here, many of whom successfully get answers to their problems.

    "WPF has many lovers. It's a veritable porn star!" - Josh Smith

    As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

    My blog | My articles | MoXAML PowerToys | Onyx

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #21

    Thanks for the advice, PS: Advice is the only thing that can be given to anyone free of cost!

    R 1 Reply Last reply
    0
    • 0 0x3c0

      My answer was not intended to be hurtful; if you took it that way then I apologise. I didn't realise that posting the name of a class would be offensive. However, you received the answer to the precise question you asked, which was (in my eyes): how do I save a .bat file to a given location? Anyway, to the point at hand:

      Rajdeep.NET wrote:

      I know that I have to use the StreamWriter method and create a text file, where I'll enter the required execution parametres and then convert it to .bat using the File.Move() method

      Just to point out, the path of the file you pass to the StreamWriter constructor doesn't have have to be a text file. You could create "FilePath.bat" in situ, which would eliminate the need for File.Move This also goes a long way towards answering your full question. If you have the folder path from a DirectoryInfo instantiation, then passing this path to the StreamWriter(string) constructor will create the file in the given location. If you want the parent directory, then Path.GetDirectoryName can be used Incidentally, the phrase "location where the folder is saved" isn't strictly accurate. For the sake of learning, you could have typed "the folder's parent directory"

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #22

      Thank you, that was useful and eyeopening. :)

      1 Reply Last reply
      0
      • F fly904

        Your question is idiotic and lacks common sense.

        Rajdeep.NET wrote:

        I have to get the folder path using the DirectoryInfo[] method.

        So you have the folder path.

        Rajdeep.NET wrote:

        But how will I generate a batch file (txt file renamed as .bat executable) in the location where the folder is saved?

        You have the folder path and the new name of the file you are creating. And you're still asking how to save it in the folder! Hang on a second while I search for something on Google[^].... WOW! What a surprise! The first link tells me exactly how to do it!

        My failometer is detecting vast quantities of FAIL! "Its SQL - hardly programming..." (Caslen)

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #23

        I apologise...

        1 Reply Last reply
        0
        • G Guffa

          What's your problem? I try to be helpful, and what do I get for that? You call it useless and hurtful. I can understand if you don't find the advice very helpful if it's not exactly what you are looking for, but it's certainly not useless. If you find it hurtful, then it's certainly not my fault, and something that you have to work on yourself. If you can't even read well meaning advice without being hurt, you should definitely not be asking questions in a forum, but rather seek professional help.

          Despite everything, the person most likely to be fooling you next is yourself.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #24

          Sorry... From now on, I'll try to help myself out, rather wandering around the forum. Because, I dont want that others be harrased just for my stupid posts. I really apologize....:~

          1 Reply Last reply
          0
          • L Lost User

            Hi Eliotta, For your kind information, I am upto no malicious stuff. Rather, I am focusing all my attention towards the security angle, imlementing .NET. I need to block folders for security purposes and not for heuristic ones. If it would had been for me, then I would have never consulted you guys, since I am doing it by using a simple batch trick which I already posted as a reply to Dave Kreskowiak.... But this is for users, not just for me or you. Yeah I agree that replicating files and hiding console applications sounds malicious but I am just trying to test my software. Its almost done but, the only problem I am facing is in the question. I need to hide my console application, because it will take a lot of time to process and so I only wanted to avoid the console window for the users. Thats all.... Otherwise, I am not going for anything like the dotnut or the sharpie virus because I am just 16 now. And I am trying to focus entirely on development else huer. Cheers, Rajdeep.NET :(

            C Offline
            C Offline
            Colin Angus Mackay
            wrote on last edited by
            #25

            Rajdeep.NET wrote:

            I need to hide my console application, because it will take a lot of time to process and so I only wanted to avoid the console window for the users. Thats all....

            Change the project properties for the exe to a Windows application. Then it won't show a console, and since your application doesn't show any windows (I hope) then it will just run in the background.

            Man who stand on hill with mouth open wait long time for roast duck to drop in

            1 Reply Last reply
            0
            • L Lost User

              There are plenty of software which lock your folders, some are free, other costs a lot of money. Why you’ll waste time and money when you could do it with your notepad. * Consider you want to lock a folder named PICS in your D:\, whose path is D:\PICS * Now open the Notepad and type the following ren pics pics.{21EC2020-3AEA-1069-A2DD-08002B30309D} * Where pics is your folder name. Save the text file as loc.bat in the same drive. * Open another new notepad text file and type the following ren pics.{21EC2020-3AEA-1069-A2DD-08002B30309D} pics * Save the text file as key.bat in the same drive. Usage: * To lock the pics folder, simply click the loc.bat and it will transform into control panel icon which is inaccessible. * To unlock the folder click the key.bat file. Thus the folder will be unlocked and the contents are accessible. Thats is what I want to do using C#.NET and nothing malicious in it, I guess. I swear I am upto no malicious thing. I cant make things to be understand properly because I am poor in english and that turns to be malicious, I dont know why!? Rajdeep.NET :sigh:

              C Offline
              C Offline
              Colin Angus Mackay
              wrote on last edited by
              #26

              Rajdeep.NET wrote:

              it will transform into control panel icon which is inaccessible

              It hasn't really locked it. It has just made the file unusable in Window Explorer - You can still access the file via other routes.

              Man who stand on hill with mouth open wait long time for roast duck to drop in

              L 1 Reply Last reply
              0
              • C Colin Angus Mackay

                Rajdeep.NET wrote:

                it will transform into control panel icon which is inaccessible

                It hasn't really locked it. It has just made the file unusable in Window Explorer - You can still access the file via other routes.

                Man who stand on hill with mouth open wait long time for roast duck to drop in

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #27

                Hi Colin, Can you suggest me any such route via which I can access the folder? I thought that it was blocked while it transformed into the control panel icon and if tried to access it, it would navigate to the Control panel.

                D 1 Reply Last reply
                0
                • L Lost User

                  Rajdeep.NET (Thats me) wrote:

                  Hi pals, I am trying to create a small utility which can block folders from direct access. For this purpose, I have a textbox in my form and a two buttons namely: browse and apply. Now, whenever the user clicks on browse, the Open file dialog box appears and whatever folder has been selected by the user is displayed in the textbox. Now, comes the major problem. In order to block the particular folder selected by the user, I have to generate two batch files (files with .bat extension) on the location of the folder, that has to be locked. Like if the folder to be blocked is in this 'C:\\myfolder\\subfolder\\lockfolder' location, where lockfolder is the particular folder which I have to lock, then in that case, I have to generate a batch file in 'C:\\my folder\\subfolder\' that will lock the folder 'lockfolder'. Any Idea how to do that..... please recommend. Sorry for my poor english, Cheers to you, Rajdeep.NET

                  :sigh: :sigh: :sigh: So many replies but all useless and hurtful...... I hope that you guys should had read the question properly before commenting. Some said, "Learn to google", while some said, "learn C#"!!! Someone even said that I was upto some malicious thing. What a DUMB thinking!!!! I wonder, how I could create a virus or any other malware stuff using .NET?! Wont the to be infected system require .NET framework to be installed already....before hand in order to make the .exe malware functioning? Or will my virus show "Invalid Win32 Application" || "The application failed to initialize properly"???!!!! :laugh: Why comment when you are not at all capable for sorting out my problem or suggesting a comprehensive way to solve it (I dont mean that you directly handover a code to me, because I know that you wont be paid for writing codes for me) All sort of British Mumbo Jumbo prevails here, it seems. And I remember, even somebody said that all my postings were flagged RED! Now, let me directly come to the point. Whats so funny about my question?! Some said that I have to use the StreamWriter method and yes, I am familiar to that ofcourse. I ain't idiot. Actually my way of posting the question was incorrect. Thats it. I am not a Graduate in English as you all are and neither is my mother tongue english. So here I am once again to explain my problem more comprehensively: I know that I have to use the StreamWriter method and create a text file, where I'll enter

                  OriginalGriffO Offline
                  OriginalGriffO Offline
                  OriginalGriff
                  wrote on last edited by
                  #28

                  Rajdeep, Why do you think you receive sugestions that you should "learn to google", "learn C#", "Go read a book", etc.? Could it be: That you continually ask basic questions? That you show no knowledge of the subjects? That you show no signs of learning from previous answers? That you don't seem to think about what you are doing, at all? I do not care if you are sixteen or sixty. It does not matter how good your english is. Many poeple here have much worse english than you, but they get help. Sometimes it means asking them to rephrase the question, but not always. Look at the questions that get answers: what do they have, that yours don't? Effort. Signs that the askee is trying to learn, rather than sitting there expecting to be spoon fed. And you are suprised and hurt when people don't give you what you want! I will add some advice to my previous sugestions: Grow up. The world is a big, unfriendly place. If you annoy people, they will not help you.

                  No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

                  "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                  "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                  L 1 Reply Last reply
                  0
                  • L Lost User

                    Thanks for the advice, PS: Advice is the only thing that can be given to anyone free of cost!

                    R Offline
                    R Offline
                    Rajesh R Subramanian
                    wrote on last edited by
                    #29

                    Rajdeep.NET wrote:

                    PS: Advice is the only thing that can be given to anyone free of cost!

                    Apparently, advice is not the only thing that is given free of cost here. As a matter of fact, we give professional guidance, suggestions, source code, etc,. and that's FREE OF COST. Not to mention the articles. You just need to take your head out that dark hole to see it. You also need to relaise that you have made yourself the butt of a joke here and you cannot blame anyone else for that. And the advice you were talking about, came from a man whose development experience is more than my age. If I were you, I would have taken his advice very seriously instead of mocking him or posting meaningless stuff any further. With millions of members and literally hundreds of queries solved across several boards each and every day here, if *you* have a problem, then *you* need an attitude adjustment, not anyone else.

                    It is a crappy thing, but it's life -^ Carlo Pallini

                    1 Reply Last reply
                    0
                    • OriginalGriffO OriginalGriff

                      Rajdeep, Why do you think you receive sugestions that you should "learn to google", "learn C#", "Go read a book", etc.? Could it be: That you continually ask basic questions? That you show no knowledge of the subjects? That you show no signs of learning from previous answers? That you don't seem to think about what you are doing, at all? I do not care if you are sixteen or sixty. It does not matter how good your english is. Many poeple here have much worse english than you, but they get help. Sometimes it means asking them to rephrase the question, but not always. Look at the questions that get answers: what do they have, that yours don't? Effort. Signs that the askee is trying to learn, rather than sitting there expecting to be spoon fed. And you are suprised and hurt when people don't give you what you want! I will add some advice to my previous sugestions: Grow up. The world is a big, unfriendly place. If you annoy people, they will not help you.

                      No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #30

                      Hi OriginalGriff, I already apologized and I promise not to ask any basic questions from now on. And I really respect you people. I am just 5 to 6 months experienced in .NET, whereas the other guys replying to my queries, including you, are like Grand Masters to me. Yeah I dont know why I go crazy when I dont get what I want. Thats my attitude and I need to change it. The best of all this is that, I am lucky enough to get suggestions and advices from these many people out here. But maybe, I failed to understand those suggetions. Goodbye forever, Rajdeep.NET :((

                      1 Reply Last reply
                      0
                      • L Lost User

                        Dave Kreskowiak wrote:

                        On top of that, I can't think of a single, good, supportable solution to block and unblock folders using batch files and because of that, I have to question your knowledge of Windows Security and NTFS.

                        Hi Dave, Ofcourse theres a brilliant and supported solution to block folders using batch files!!! Here's how: There are plenty of software which lock your folders, some are free, other costs a lot of money. Why you’ll waste time and money when you could do it with your notepad. * Consider you want to lock a folder named PICS in your D:\, whose path is D:\PICS * Now open the Notepad and type the following ren pics pics.{21EC2020-3AEA-1069-A2DD-08002B30309D} * Where pics is your folder name. Save the text file as loc.bat in the same drive. * Open another new notepad text file and type the following ren pics.{21EC2020-3AEA-1069-A2DD-08002B30309D} pics * Save the text file as key.bat in the same drive. Usage: * To lock the pics folder, simply click the loc.bat and it will transform into control panel icon which is inaccessible. * To unlock the folder click the key.bat file. Thus the folder will be unlocked and the contents are accessible. That’s all. Is that clear o you now! Cheers, Rajdeep.NET :zzz:

                        D Offline
                        D Offline
                        Dave Kreskowiak
                        wrote on last edited by
                        #31

                        That's an old and very defeatable trick. Plus, if you setup your NTFS security permissions correctly, you don't have to do this at all and it can't be defeated!

                        A guide to posting questions on CodeProject[^]
                        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                             2006, 2007, 2008

                        1 Reply Last reply
                        0
                        • L Lost User

                          Hi Colin, Can you suggest me any such route via which I can access the folder? I thought that it was blocked while it transformed into the control panel icon and if tried to access it, it would navigate to the Control panel.

                          D Offline
                          D Offline
                          Dave Kreskowiak
                          wrote on last edited by
                          #32

                          That only fools Explorer. It doesn't do anything to stop someone from using their own version of Explorer, and better yet, doesn't stop anyone from using the CMD prompt to get into the folder and renaming it back to normal. Again, you're lack of understanding of Windows, Windows Security and NTFS is glaringly obvious.

                          A guide to posting questions on CodeProject[^]
                          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                               2006, 2007, 2008

                          modified on Wednesday, May 27, 2009 7:35 AM

                          1 Reply Last reply
                          0
                          • L Lost User

                            Hi Eliotta, For your kind information, I am upto no malicious stuff. Rather, I am focusing all my attention towards the security angle, imlementing .NET. I need to block folders for security purposes and not for heuristic ones. If it would had been for me, then I would have never consulted you guys, since I am doing it by using a simple batch trick which I already posted as a reply to Dave Kreskowiak.... But this is for users, not just for me or you. Yeah I agree that replicating files and hiding console applications sounds malicious but I am just trying to test my software. Its almost done but, the only problem I am facing is in the question. I need to hide my console application, because it will take a lot of time to process and so I only wanted to avoid the console window for the users. Thats all.... Otherwise, I am not going for anything like the dotnut or the sharpie virus because I am just 16 now. And I am trying to focus entirely on development else huer. Cheers, Rajdeep.NET :(

                            L Offline
                            L Offline
                            Lost User
                            wrote on last edited by
                            #33

                            Please, go away. Don't continue. I'm tired of your posts beyond belief. I don't believe you, I don't think anyone is.

                            Check out the CodeProject forum Guidelines[^]

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups