想要使用批处理文件隐藏所有文件夹. [英] want to hide ALL folder using a batch file..

查看:67
本文介绍了想要使用批处理文件隐藏所有文件夹.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

但是在我的代码特定的文件夹中,当我单击隐藏所有"时,可以隐藏我想要的东西,该文件商不仅必须隐藏一个文件夹...

but in my code specific folder can be hide what I want is when I click Hide ALL the fodler must hide not only ONE folder...

#include<iostream>
#include<string.h>
//#include<stdlib.h>
#include<conio.h>
#include<process.h>

using namespace std;
main()
{
      FILE *p;
      char ch,s[100];
      char r[100]="ren ";

      //hide
      char u[]=" \"Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}\"\n attrib +h +s \"Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}\"";
      //unhide
      char h[]="attrib -h -s \"Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}\"\nren \"Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}\" ";
      char v[50];
      int choice,i;


      p=fopen("D:\\a.bat","w+");
      if(p==NULL)
      {
           cout<<"Error in opening the file a.c";
           getch();
           exit(0);
      }

       cout<<"Enter choice :\n";
       cout<<"1.Hide Folder/File\n";
       cout<<"2.UnHide folder/File\n";
       cout<<"3.Exit \n";
       cin>>choice;

       switch(choice)
       {
        case 1:
             cout<<"Enter new name of your folder/file: ";
             fflush(stdin);
             gets(v);
             strcat(r,v);
             strcat(r,u);
        //     cout<<r;
             fputs(r,p);
             break;


        case 2:
             strcpy(r,"");
             strcat(r,h);
             cout<<"Enter new name of your folder/file: ";
             fflush(stdin);
             gets(v);
             strcat(r,v);
             fputs(r,p);
             break;

             default:
                     fclose(p);
                     remove("D:\a.bat");
                     system("pause");
                     exit(0);
        }


        fclose(p);
        system("D:\\a.bat");
        remove("D:\\a.bat");
        //system("pause");
        getch();
}

推荐答案

在该文件中创建一个批处理文件
执行命令"ATTRIB + H *.*"
create a batch file in that
execute command "ATTRIB +H *.*"


如果您想隐藏从给定文件夹开始的所有文件夹和文件,则可以使用attrib + h *.*/s

/s将包含当前文件夹中的所有子项目.

希望这会有所帮助.
If you''re wanting to hide all folders and files starting at a given folder, you can use the attrib +h *.* /s

The /s will include all subitems from the current folder.

Hope this helps.


这篇关于想要使用批处理文件隐藏所有文件夹.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆